Levels of fibroblast growth factor 23 (FGF23) are elevated in chronic kidney disease (CKD) and strongly associated with left ventricular hypertrophy, heart failure, and death. Whether FGF23 is an independent risk factor for atrial fibrillation in CKD is unknown. To investigate the association of FGF23 with atrial fibrillation in CKD. Prospective cohort study of 3876 individuals with mild to severe CKD who enrolled in the Chronic Renal Insufficiency Cohort Study between June 19, 2003, and September 3, 2008, and were followed up through March 31, 2013. Baseline plasma FGF23 levels. Prevalent and incident atrial fibrillation. The study cohort comprised 3876 participants. Their mean (SD) age was 57.7 (11.0) years, and 44.8% (1736 of 3876) were female. Elevated FGF23 levels were independently associated with increased odds of prevalent atrial fibrillation (n = 660) after adjustment for cardiovascular and CKD-specific factors (odds ratio of highest vs lowest FGF23 quartile, 2.30; 95% CI, 1.69-3.13; P < .001 for linear trend across quartiles). During a median follow-up of 7.6 years (interquartile range, 6.3-8.6 years), 247 of the 3216 participants who were at risk developed incident atrial fibrillation (11.9 events per 1000 person-years). In fully adjusted models, elevated FGF23 was independently associated with increased risk of incident atrial fibrillation after adjustment for demographic, cardiovascular, and CKD-specific factors, and other markers of mineral metabolism (hazard ratio of highest vs lowest FGF23 quartile, 1.59; 95% CI, 1.00-2.53; P = .02 for linear trend across quartiles). The results were unchanged when further adjusted for ejection fraction, but individual adjustments for left ventricular mass index, left atrial area, and interim heart failure events partially attenuated the association of elevated FGF23 with incident atrial fibrillation. Elevated FGF23 is independently associated with prevalent and incident atrial fibrillation in patients with mild to severe CKD. The effect may be partially mediated through a diastolic dysfunction pathway that includes left ventricular hypertrophy, atrial enlargement, and heart failure events.