BackgroundNutritional factors including vitamin D, magnesium, and fat are known to affect bone mineral accrual. This study aimed to evaluate associations between dietary nutrient intakes (both macronutrients and micronutrients) and bone mineral density (BMD) in children and adolescents.MethodsData for this cross-sectional, population-based study were derived from the National Health and Nutrition Examination Survey (NHANES). Participants aged from 8 to 19 years were included. The primary outcome was femoral neck BMD.ResultsMultivariate analyses revealed that for participants aged 8 to 11, daily sodium intake was significantly and positively associated with femoral neck BMD (B = 0.9 × 10− 5, p = 0.031); in particular, subgroup analyses by sex found that in male participants aged 8–11, daily total cholesterol intake (B = 5.3 × 10− 5, p = 0.030) and calcium intake (B = − 2.0 × 10− 5, p < 0.05) were significantly associated with femoral neck BMD in a positive and negative manner, respectively, but neither were observed in female participants of this age group. In contrast, daily intakes of vitamin D and magnesium were significantly and positively associated with femoral neck BMD in female participants aged 8–11 (B = 246.8 × 10− 5 and 16.3 × 10− 5, p = 0.017 and 0.033, respectively). For participants aged 16 to 19, daily total fat intake was significantly and negatively associated with femoral neck BMD (B = − 58 × 10− 5, p = 0.048); further stratification by sex found that magnesium and sodium intakes were significantly and positively associated with femoral neck BMD only in females of this age group (B = 26.9 × 10− 5 and 2.1 × 10− 5, respectively; both p < 0.05). However, no significant associations between daily nutrient intakes and femoral neck BMD were identified in participants aged 12–15 before or after subgroup stratification.ConclusionThe study found that associations of specific nutrition-related variables with BMD of the femoral neck is dependent upon age and gender.