Cardiac complications, particularly myocarditis and pericarditis, have been associated with SARS-CoV-2 (the virus that causes COVID-19) infection (1-3) and mRNA COVID-19 vaccination (2-5). Multisystem inflammatory syndrome (MIS) is a rare but serious complication of SARS-CoV-2 infection with frequent cardiac involvement (6). Using electronic health record (EHR) data from 40 U.S. health care systems during January 1, 2021-January 31, 2022, investigators calculated incidences of cardiac outcomes (myocarditis; myocarditis or pericarditis; and myocarditis, pericarditis, or MIS) among persons aged ≥5 years who had SARS-CoV-2 infection, stratified by sex (male or female) and age group (5-11, 12-17, 18-29, and ≥30 years). Incidences of myocarditis and myocarditis or pericarditis were calculated after first, second, unspecified, or any (first, second, or unspecified) dose of mRNA COVID-19 (BNT162b2 [Pfizer-BioNTech] or mRNA-1273 [Moderna]) vaccines, stratified by sex and age group. Risk ratios (RR) were calculated to compare risk for cardiac outcomes after SARS-CoV-2 infection to that after mRNA COVID-19 vaccination. The incidence of cardiac outcomes after mRNA COVID-19 vaccination was highest for males aged 12-17 years after the second vaccine dose; however, within this demographic group, the risk for cardiac outcomes was 1.8-5.6 times as high after SARS-CoV-2 infection than after the second vaccine dose. The risk for cardiac outcomes was likewise significantly higher after SARS-CoV-2 infection than after first, second, or unspecified dose of mRNA COVID-19 vaccination for all other groups by sex and age (RR 2.2-115.2). These findings support continued use of mRNA COVID-19 vaccines among all eligible persons aged ≥5 years.