Intracameral injection is an effective method for preventing infection, but no controlled study has been published in the United States. We conducted an observational, longitudinal cohort study to examine the effect of topical and injected antibiotics on risk of endophthalmitis. We identified 315 246 eligible cataract procedures in 204 515 members of Kaiser Permanente, California, 2005-2012. The study used information from the membership, medical, pharmacy, and surgical records from the electronic health record. The adjusted odds ratio (OR) and 95% confidence interval (CI) for the association of antibiotic prophylaxis (route and agent) with risk of endophthalmitis was estimated using logistic regression analysis. We confirmed 215 cases of endophthalmitis (0.07% or 0.7/1000). Posterior capsular rupture was associated with a 3.68-fold increased risk of endophthalmitis (CI, 1.89-7.20). Intracameral antibiotic was more effective than topical agent alone (OR, 0.58; CI, 0.38-0.91). Combining topical gatifloxacin or ofloxacin with intracameral agent was not more effective than using an intracameral agent alone (compared with intracameral only: intracameral plus topical, OR, 1.63; CI, 0.48-5.47). Compared with topical gatifloxacin, prophylaxis using topical aminoglycoside was ineffective (OR, 1.97; CI, 1.17-3.31). Surgical complication remains a key risk factor for endophthalmitis. Intracameral antibiotic was more effective for preventing post-cataract extraction endophthalmitis than topical antibiotic alone. Topical antibiotic was not shown to add to the effectiveness of an intracameral regimen.