Cardioversion is a procedure used to restore a normal heart rhythm in patients with certain types of arrhythmias, such as atrial fibrillation. It can be done using electrical shocks (electrical cardioversion) or medications (chemical cardioversion) to reset the heart’s rhythm and improve its function.