ImportanceWhether the simultaneous intravenous administration of potassium and magnesium is associated with the probability of spontaneous conversion to sinus rhythm (SCV) in the acute treatment of atrial fibrillation (AF) and atrial flutter (AFL) is unknown.ObjectiveTo assess potassium and magnesium administration and SCV probability in AF and AFL in the emergency department.Design, Setting, and ParticipantsA registry-based cohort study was conducted in the Department of Emergency Medicine of the Medical University of Vienna, Austria. All consecutive patients with AF or AFL were screened between February 6, 2009, and February 16, 2020.InterventionsIntravenous administration of potassium, 24 mEq, and magnesium, 145.8 mg.Main Outcomes and MeasuresThe primary outcome was the probability of SCV during the patient’s stay in the emergency department. Multivariable cluster-adjusted logistic regression was used to estimate the association between potassium and magnesium administration and the probability of SCV.ResultsA total of 2546 episodes of nonpermanent AF (median patient age, 68 [IQR, 58-75] years, 1411 [55.4%] men) and 573 episodes of nonpermanent AFL (median patient age, 68 [IQR, 58-75] years; 332 [57.9%] men) were observed. In AF episodes, intravenous potassium and magnesium administration vs no administration was associated with increased odds of SCV (19.2% vs 10.4%; odds ratio [OR], 1.98; 95% CI, 1.53-2.57). In AFL episodes, in contrast, no association was noted for the probability of SCV with potassium and magnesium vs no administration (13.0% vs 12.5%; OR, 1.05; 95% CI, 0.65-1.69).Conclusions and RelevanceThe findings of this registry-based cohort study on intravenous administration of potassium and magnesium suggest an increased probability of SCV in nonpermanent AF, but not AFL, during a patients’ stay in the emergency department.