A growing number of studies suggest that diet and renal function are related. However, little is known about the link between both whole grain (WG) and refined grain (RG) consumption and kidney function parameters. Thus, we investigated the association of WG and RG with urinary albumin to creatinine ratio (ACR) and prevalent chronic kidney disease (CKD). Data from participants of the National Health and Nutrition Examination Surveys (NHANES) from 2005 to 2010 were collected. Estimated glomerular filtration rate (eGFR) was calculated by the CKD Epidemiology Collaboration equation. Survey design and sample weights were taken into consideration for statistical analyses. Finally, we included 16 325 participants from NHANES, 6·9 % of whom had prevalent CKD. In models adjusted for age, sex, race, fasting blood glucose, blood pressure, adiposity, hypertension and diabetes status, mean eGFR significantly increased across increasing quartiles of WG (Q1: 88·2 v. Q4: 95·4 ml/min per 1·73 m2, P<0·001), whereas it significantly decreased across increasing quartiles of RG (Q1: 97·2 v. Q4: 88·4 ml/min per 1·73 m2, P<0·001). Furthermore, serum uric acid levels and ACR significantly decreased across quartiles of WG (both P<0·001). In multivariable-adjusted logistic regression models, the likelihood of prevalent CKD was 21 % lower in the highest WG quartile compared with the lowest one. In conclusion, our results shed light on the beneficial impact of WG on kidney function and CKD, whereas RG is adversely associated with eGFR.