To explore whether variability in dietary cholesterol and phytosterol absorption impacts the risk of coronary artery disease (CAD) using as instruments sequence variants in the ABCG5/8 genes, key regulators of intestinal absorption of dietary sterols.We examined the effects of ABCG5/8 variants on non-high-density lipoprotein (non-HDL) cholesterol (N up to 610 532) and phytosterol levels (N = 3039) and the risk of CAD in Iceland, Denmark, and the UK Biobank (105 490 cases and 844 025 controls). We used genetic scores for non-HDL cholesterol to determine whether ABCG5/8 variants confer greater risk of CAD than predicted by their effect on non-HDL cholesterol. We identified nine rare ABCG5/8 coding variants with substantial impact on non-HDL cholesterol. Carriers have elevated phytosterol levels and are at increased risk of CAD. Consistent with impact on ABCG5/8 transporter function in hepatocytes, eight rare ABCG5/8 variants associate with gallstones. A genetic score of ABCG5/8 variants predicting 1 mmol/L increase in non-HDL cholesterol associates with two-fold increase in CAD risk [odds ratio (OR) = 2.01, 95% confidence interval (CI) 1.75-2.31, P = 9.8 × 10-23] compared with a 54% increase in CAD risk (OR = 1.54, 95% CI 1.49-1.59, P = 1.1 × 10-154) associated with a score of other non-HDL cholesterol variants predicting the same increase in non-HDL cholesterol (P for difference in effects = 2.4 × 10-4).Genetic variation in cholesterol absorption affects levels of circulating non-HDL cholesterol and risk of CAD. Our results indicate that both dietary cholesterol and phytosterols contribute directly to atherogenesis.