Background Despite substantial research in the prophylaxis and treatment of postoperative atrial fibrillation (AF), it remains one of the most frequent complications following cardiac surgery. Relying on the effectiveness of sotalol in the treatment of AF, we set out to evaluate its efficacy in combination with magnesium in the prevention of AF after elective on pump coronary artery bypass surgery. Methods Between October 2003 and October 2004, 100 patients planned for elective on pump coronary artery bypass surgery were randomized into two equal groups. Exclusion criteria included an ejection fraction below 40%, a QT interval longer than 440 ms, creatinine exceeding 2 mg/dl, moderate to severe chronic obstructive pulmonary disease and a previous history of arrhythmias. The group under investigation received both sotalol and magnesium according to the scheme in Table 1. The control group received no prophylaxis but remained on their preoperative medication including beta-blockers (n = 40/50 patients). Results Statistically no significant differences in terms of age, sex, comorbidities, ejection fraction or preoperative intake of beta-blockers were seen between groups. In the prophylaxis group, the incidence of postoperative AF was significantly lower with 18% (n = 9) as compared to 40% (n = 20) in the control group. Conclusion Our results indicate that the incidence of AF after coronary artery bypass can be effectively reduced by a combination of sotalol and magnesium. Hence a postoperative prophylaxis should not only prove to be cost effective but will also reduce the additional short- and long-term morbidity caused by AF.