Azithromycin is one of the most commonly prescribed antibiotics in the US. It has been associated with an increased risk of cardiovascular death in some observational studies. To estimate the relative and absolute risks of cardiovascular and sudden cardiac death after an outpatient azithromycin prescription compared with amoxicillin, an antibiotic not known to increase cardiovascular events. This retrospective cohort study included 2 large, diverse, community-based integrated care delivery systems with comprehensive capture of encounters and prescriptions from January 1, 1998, to December 31, 2014. The cohort included patients aged 30 to 74 years who had at least 12 months of health-plan enrollment prior to antibiotic exposure. The exclusion criteria were absence of prescription benefits, prescription for more than 1 type of study antibiotic within 10 days, hospitalization or nursing home residence, and serious medical conditions. Risk of cardiovascular death associated with azithromycin vs amoxicillin exposure was calculated after controlling for confounding factors using a propensity score. Data were analyzed from December 1, 2016, to March 30, 2020. Outpatient prescription of azithromycin or amoxicillin. The primary outcomes were cardiovascular death and sudden cardiac death. An a priori subgroup analysis quantified the effects of azithromycin exposure among patients with increased baseline cardiovascular risk. The secondary outcomes were noncardiovascular death and all-cause mortality. The study included 7 824 681 antibiotic exposures, including 1 736 976 azithromycin exposures (22.2%) and 6 087 705 amoxicillin exposures (77.8%), among 2 929 008 unique individuals (mean [SD] age, 50.7 [12.3] years; 1 810 127 [61.8%] women). Azithromycin was associated with a significantly increased hazard of cardiovascular death (hazard ratio [HR], 1.82; 95% CI, 1.23-2.67) but not sudden cardiac death (HR, 1.59; 95% CI, 0.90-2.81) within 5 days of exposure. No increases in risk were found 6 to 10 days after exposure. Similar results were observed in patients within the top decile of cardiovascular risk (HR, 1.71; 95% CI, 1.06-2.76). Azithromycin was also associated with an increased risk of noncardiovascular death (HR, 2.17; 95% CI, 1.44-3.26) and all-cause mortality (HR, 2.00; 95% CI, 1.51-2.63) within 5 days of exposure. These findings suggest that outpatient azithromycin use was associated with an increased risk of cardiovascular death and noncardiovascular death. Causality cannot be established, particularly for noncardiovascular death, owing to the likelihood of residual confounding.