Postoperative arrhythmia (POA) is the most common complication encountered after cardiopulmonary bypass (CPB). The preventive effect of magnesium in POA has been confirmed by metaanalyses in adults, but less is known in pediatric patients. A metaanalysis of published trials was conducted to examine the efficacy of magnesium supplementation in POA prevention among pediatric patients undergoing CPB. Relevant trials were identified from electronic databases (Medline, Embase, Web of Science, and Cochrane library). Pooled relative risk (RR) and 95 % confidence intervals (CI) were calculated using Mantel-Haenszel random-effects models, and heterogeneity was determined qualitatively according to I (2) and chi-squared statistical analyses. Among 121 potentially relevant studies, five randomized controlled trials met the inclusion criteria, resulting in a pooled total of 348 participants. Compared with placebo, magnesium supplementation decreased the incidence of arrhythmia after CPB in pediatric patients by 66 % (RR, 0.34; 95 % CI, 0.18-0.65; P = 0.001), with no heterogeneity between trials (heterogeneity P = 0.68; I (2) = 0 %). Magnesium supplementation significantly reduces the incidence of postoperative arrhythmias in pediatric patients undergoing CPB. Although the findings encourage the use of magnesium as an alternative to postoperative arrhythmias after CPB in pediatric patients, higher-quality randomized clinical trials are necessary before the findings can be generalized.