Vitamin D metabolites and the gut microbiota dietary index are associated with reduced all-cause mortality in US adults: a prospective cohort study Authors: Qiang Zou, Bolin Fu, Yongsheng Gou, Gang Zhong, Yalan Liu Published: 2025 ABSTRACT BackgroundVitamin D and the gut microbiota are known to influence immune function, inflammation, and long-term health outcomes, including mortality. However, the interplay among vitamin D metabolites, microbiota-related dietary patterns, and mortality risk remains unclear.MethodsThis prospective cohort study was conducted with data from 19,278 subjects enrolled in the National Health and Nutrition Examination Survey of 2005–2018. DI-GM, a surrogate measure derived from 24-h dietary recall data rather than direct microbiome sequencing, was used to evaluate the impacts of diet on the gut microbiota. The relationships and potential mediating effects were determined through Cox proportional hazards regression, restricted cubic splines, and mediation analysis. In addition, subgroup analyses were conducted to investigate the effect modifications based on age, diabetes status, and cancer or malignancy history. The study results were analyzed to gain a comprehensive understanding of the relationships under investigation.ResultsHigher contents of vitamin D and its metabolites were related to a decreased risk of all-cause mortality (HR for 25-hydroxyvitamin D3: 0.60, 95% CI: 0.53–0.68; epi-25-hydroxyvitamin D3: 0.62, 95% CI: 0.54–0.71). DI-GM was inversely related to mortality risk (HR: 0.80, 95% CI: 0.71–0.91). In the mediation analysis, DI-GM accounted for less than 10% of the total effect. ConclusionsThe present study revealed the inverse relationships of vitamin D and DI-GM with mortality and that DI-GM partially mediated these relationships. The. results highlighted the potential effects of vitamin D and the gut microbiota in terms of improving survival outcomes, although further longitudinal studies are warranted to validate these relationships.Supplementary InformationThe online version contains supplementary material available at 10.1186/s40795-025-01211-1. Introduction All-cause mortality is a critical indicator of global health and is affected by complicated interactions among genetic, socioeconomic, and lifestyle factors [1, 2]. The gut microbiota, also referred to as the “second genome”, has recently gained increasing attention for its effects on health and disease [3]. The gut microbiota directly participates in food metabolism, toxin degradation, and immune regulation while indirectly modulating disease progression by influencing host metabolism and inflammatory responses [4]. Gut dysbiosis is suggested to be strongly related to a higher risk of chronic disorders, such as cardiovascular diseases, diabetes, and cancer, as well as to a heightened mortality risk [5]. The dietary index for the gut microbiota (DI-GM) is an important tool for determining the complex relationship between the gut microbiota and mortality. The DI-GM quantifies the dietary impact on the gut microbiota, thereby serving as an indirect indicator of gut health [6]. While the use of DI-GM has introduced novel perspectives in research on gut health, its specific association with all-cause mortality and its potential for application in health interventions remain underexplored. Evidence suggests that diets with abundant dietary fiber, polyphenols, and fermented dairy products enhance gut microbial diversity and functional metabolites, thereby improving host health [7]. Conversely, excessive intake of red meat, refined grains, and high-fat diets is strongly associated with gut microbiota imbalance and an increased risk of chronic inflammation [8]. However, systematic studies on the impact of diet on the gut microbiota and its indirect influence on mortality are scarce. Further exploration of how dietary patterns regulate gut health and survival outcomes in individuals could provide necessary data for the development of precise dietary intervention strategies. Vitamin D is a vital fat-soluble vitamin with various physiological functions, including promoting calcium and phosphorus metabolism, modulating immune responses, and suppressing inflammatory processes [9]. The interaction of vitamin D with the gut microbiota has recently gained increasing attention. Research has demonstrated that vitamin D improves the gut microbial structure by regulating gut barrier function and inflammatory responses [10]. Observational studies have consistently linked vitamin D deficiency to gut dysbiosis and higher rates of disease incidence and mortality [11]. For example, population-based cohort studies have reported associations between low serum 25-hydroxyvitamin D levels and an increased risk of all-cause mortality. In contrast, interventional trials, including randomized controlled trials (RCTs) of vitamin D supplementation, have demonstrated causal effects on the gut microbiota. One such RCT showed that vitamin D supplementation significantly increased the Firmicutes-to-Bacteroidetes ratio, contributing to improved gut microbial balance [12]. Population studies have linked vitamin D deficiency to gut dysbiosis and higher rates of disease incidence and mortality [13]. However, the specific mechanisms through which vitamin D modulates the risk of mortality via the gut microbiota remain unclear. In addition, systemic studies exploring the differential roles of vitamin D metabolites, such as 25-hydroxyvitamin D3 and 3-epi-25-hydroxyvitamin D3, and those investigating whether the protective effects of vitamin D vary across different populations are scarce. In the above context, the present study used data from the 2005–2018 National Health and Nutrition Examination Survey (NHANES). It comprehensively analyzed these data to determine the relationships among vitamin D, its metabolites, and DI-GM. In addition, this study explored the potential effect of DI-GM in terms of regulating the association of vitamin D with all-cause mortality. The following aspects were focused on in the present study: (1) verifying the relationships of vitamin D and its metabolites with DI-GM; (2) evaluating the effect of DI-GM in terms of regulating the relationship between vitamin D and mortality; and (3) investigating whether vitamin D exhibits heterogeneous protection across subgroups. We hypothesize that higher levels of vitamin D and its metabolites are associated with a reduced risk of all-cause mortality, that DI-GM is inversely associated with all-cause mortality, and that DI-GM partially mediates the relationship between vitamin D and mortality. The objective of these analyses was to elucidate how vitamin D affects mortality via gut microbiota regulation and thereby provide novel insights for developing precise nutritional interventions and chronic disease prevention strategies. Methods Study design and participants This study utilized baseline cross-sectional data from NHANES 2005–2018, which were linked prospectively to mortality outcomes through December 31, 2019, forming a cohort design for survival analyses. While baseline assessments (e.g., vitamin D levels and DI-GM) were cross-sectional, the inclusion of follow-up time in Cox models enables prospective evaluation of mortality risk. The study protocol was approved by the Ethics Review Board of the National Center for Health Statistics. Informed consent was obtained from each participant [14]. The subjects aged ≥ 20 years were enrolled as study participants. Subjects younger than 20 years of age (n = 30,441), those with incomplete DI-GM data (n = 13,704), those lacking vitamin D and metabolite data (n = 2,246), those with no all-cause mortality data (n = 17), those with abnormal vitamin D and metabolite levels (n = 477), or those with missing covariate information (n = 4,027) were excluded from the study. Finally, 19,278 subjects were included in the final analysis. The details of the final list of participants included in the study are provided in Fig. 1. Fig. 1Flowchart illustrating the process of participant selection Flowchart illustrating the process of participant selection Vitamin D and its metabolites The serum contents of vitamin D and its metabolites were quantified using high-performance liquid chromatography-tandem mass spectrometry (HPLC-MS/MS). The analysis revealed 25-hydroxyvitamin D3 (25OHD3), total vitamin D, and 3-epi-25-hydroxyvitamin D3 (3-epi-25OHD3) as the primary analytes. Chromatographic separation was achieved using one of three pentafluorophenyl columns, with a mobile phase comprising 69–72% methanol in water used for optimized separation. Sample preparation involved adding a pretreatment solution to the serum for extraction, ensuring that the reconstitution and needle wash solutions matched the mobile phase composition, thereby ensuring accuracy and reproducibility. The detailed procedures are available in the NHANES 2017–2018 laboratory manual [15]. The lower limit of detection (LLOD) was computed as LLOD/sqrt(2). Mediating variables The NHANES employed a dual dietary recall methodology, in which one 24-h dietary recall interview was conducted at the Mobile Examination Center (MEC), followed by one comprehensive telephone interview. In this process, the dietary intake of the subjects, including each food and beverage item consumed, was recorded meticulously for 24 h. Bezawit E. Kase et al. identified 14 key foods and nutrients for inclusion in the diet-induced gut microbiota (DI-GM) score, which is calculated based on items segmented into 10 beneficial foods and 4 detrimental foods [6]. A beneficial food intake higher than the sex-specific median is assigned a score of 1, whereas a score of 0 is assigned for a lower intake. The intake of detrimental foods is scored inversely. The final DI-GM score (range, 0–14) is a factor indicating gut health, with a greater score indicating a more favorable gut microbiota profile [16]. All-cause mortality assessment The mortality data recorded until 31 December 2019 were obtained using the probabilistic matching algorithm, which links NHANES data with the National Death Index (NDI). In line with the International Classification of Diseases 10th Revision (ICD-10), all mortality causes were coded. All-cause mortality included deaths that occurred due to any disorder or condition [17]. Covariates The potential confounders included demographic information, socioeconomic status, lifestyle factors, and disease history. The demographic data included age, gender, race, and education level (less than high school, high school, or above). Socioeconomic status was assessed based on the family income-to-poverty ratio (PIR), which was classified as low, medium, or high (PIR < 1.0, 1.0–3.0, or ≥ 3.0) [18]. Lifestyle factors included smoking and drinking status. Smoking was defined based on whether an individual had smoked more than 100 cigarettes in their lifetime (ever smoked if yes, never smoked if not), based on NHANES self-report questionnaire data. Drinking status was determined using the NHANES variable ALQ151, which asked participants whether they had ever consumed 5 or more drinks (for males) or 4 or more drinks (for females) almost every day (heavy drinker if yes, non-heavy drinker if no) [19]. Body mass index (BMI) was classified as < 25, 25–30, or ≥ 30 kg/m2 (normal/underweight, overweight, or obese, respectively), in line with the criteria provided by the World Health Organization [15]. Hypertension was defined as self-reported physician-diagnosed hypertension, current use of antihypertensive medication, or average systolic blood pressure ≥ 140 mmHg or diastolic blood pressure ≥ 90 mmHg based on up to three measurements during the NHANES examination [20]. The diagnosis of diabetes was established when HbA1c was ≥ 6.5%, a prior medical diagnosis was present, fasting glucose was ≥ 126 mg/dL, or insulin medication was being taken currently [21]. Statistical analysis Continuous variables were tested for normality, whereas non-normally distributed data were evaluated using the Kruskal-Wallis test. All analyses accounted for the complex, multistage probability sampling design of the NHANES by incorporating appropriate sample weights (e.g., WTMEC2YR for the examination subsample including vitamin D data, adjusted across cycles), along with primary sampling units (SDMVPSU) and strata (SDMVSTRA), using the ‘survey’ package in R. This approach ensures nationally representative estimates and proper variance estimation. Categorical data were analyzed using the chi-square test. The associations among vitamin D, its metabolites, and all-cause mortality were evaluated using multivariable Cox proportional hazards models, and the results are presented as hazard ratios (HR) and 95% confidence intervals (CI). Variables, including age, gender, race, education, BMI, PIR, smoking status, alcohol consumption status, hypertension status, diabetes status, and cancer history, were adjusted in the models. The same approach was adopted during the subgroup analyses [22]. In addition, logistic regression was employed to evaluate the relationship between vitamin D and DI-GM. Mediation analysis was performed using the ‘mediation’ package of R (version 4.2.2). Survival analysis was performed using the Weibull distribution assumption and the survreg tool. The interaction effects were assessed via likelihood ratio tests to evaluate their impact on the primary outcomes [23]. P < 0.05 (two-tailed) was considered the threshold of statistical significance. Results Summary of the baseline differences across the dietary indices for the gut microbiota scores A total of 19,278 participants were categorized into quartiles based on their DI-GM scores. As shown in Table 1, participants in the highest DI-GM quartile (Q4) were older (median age: 50.0 years [Q1: 36.0, Q3: 62.0]) than those in the lowest quartile (Q1: 44.0 years [31.0, 58.0], P < 0.001). The concentrations of 25-hydroxyvitamin D3,3-epi-25-hydroxyvitamin D3, and total vitamin D increased across quartiles (P < 0.001 for all). A greater proportion of females was observed in Q4 (53.97%) than in Q1 (45.47%, P < 0.001). The spatial distribution varied significantly across quartiles (P < 0.001), with non-Hispanic whites accounting for 75.39% of the population in Q4 and 24.68% in Q1, whereas non-Hispanic blacks represented 5.28% in Q4 and 25.43% in Q1. Participants with > high school education and high income were more prevalent in Q4 (71.20% and 58.27%, respectively) than in Q1 (53.92% and 42.75%, P < 0.001). BMI also differed across quartiles, with a decreasing trend in obesity (BMI ≥ 30 kg/m2) from Q1 (41.47%) to Q4 (32.32%, P < 0.001). Smoking showed no statistically significant trend across quartiles (P = 0.094), whereas drinking was more common in Q4 (81.86%) than in Q1 (75.37%, P = 0.001). The prevalence of hypertension, diabetes, and cancer or malignancy was lower in Q4 than in Q1 (P < 0.05). Table 1Baseline characteristics of US adults in NHANES 2005–2018 by quartiles of the dietary index for the gut microbiota (DI-GM)VariablesTotal (n = 19278)Q₁(n = 4667)Q2 (n = 4717)Q3 (n = 4465)Q4 (n = 5429) P Age (years), M (Q₁, Q₃)46.00 (32.00, 59.00)44.00 (31.00, 58.00)43.00 (31.00, 57.00)46.00 (33.00, 60.00)50.00 (36.00, 62.00) < 0.001 25-hydroxyvitamin D3 (nmol/L), M (Q₁, Q₃)63.00 (46.40, 79.60)59.52 (42.50, 76.10)61.50 (45.60, 78.10)62.66 (46.20, 79.50)67.40 (50.70, 84.10) < 0.001 epi-25-hydroxyvitamin D3 (nmol/L), M (Q₁, Q₃)3.45 (2.19, 5.10)3.26 (2.00, 4.78)3.42 (2.17, 5.13)3.49 (2.21, 5.08)3.59 (2.37, 5.30) < 0.001 Vitamin D (nmol/L), M (Q₁, Q₃)66.40 (50.10, 83.00)62.40 (45.70, 78.90)65.10 (49.00, 81.00)65.80 (50.30, 82.60)70.90 (54.90, 86.80) < 0.001 Gender, n(%) < 0.001 Female50.26 (49.58, 50.94)45.47 (43.66, 47.30)49.14 (47.57, 50.71)51.20 (49.33, 53.07)53.97 (52.54, 55.39) Male49.74 (49.06, 50.42)54.53 (52.70, 56.34)50.86 (49.29, 52.43)48.80 (46.93, 50.67)46.03 (44.61, 47.46)Race, n(%) < 0.001 Mexican American8.32 (6.72, 10.25)8.85 (7.13, 10.95)10.21 (8.29, 12.52)8.99 (7.18, 11.20)5.95 (4.62, 7.62) Other Hispanic5.38 (4.42, 6.55)6.14 (4.83, 7.79)6.36 (5.06, 7.96)5.06 (4.17, 6.13)4.32 (3.53, 5.28) Non-Hispanic White69.21 (65.98, 72.26)64.28 (60.35, 68.03)65.42 (61.27, 69.34)69.72 (66.39, 72.85)75.39 (72.55, 78.03) Non-Hispanic Black10.35 (8.90, 12.00)14.54 (12.17, 17.27)11.40 (9.60, 13.49)9.69 (8.22, 11.38)6.93 (5.98, 8.01) Other Race6.74 (6.03, 7.54)6.18 (5.28, 7.24)6.62 (5.74, 7.61)6.54 (5.61, 7.62)7.41 (6.40, 8.57)Education level, n(%) < 0.001 ≤ High school37.51 (35.39, 39.67)46.08 (43.67, 48.51)41.35 (38.76, 43.98)36.71 (33.83, 39.68)28.80 (26.32, 31.40) >High school62.49 (60.33, 64.61)53.92 (51.49, 56.33)58.65 (56.02, 61.24)63.29 (60.32, 66.17)71.20 (68.60, 73.68)BMI (kg/m2), n(%) < 0.001 < 2529.44 (28.18, 30.72)25.61 (23.93, 27.36)28.06 (26.17, 30.03)29.43 (27.62, 31.32)33.34 (31.08, 35.68) 25 ~ 3033.77 (32.78, 34.78)32.92 (31.00, 34.90)34.23 (32.50, 35.99)33.41 (31.52, 35.36)34.34 (32.73, 35.98) ≥ 3036.79 (35.61, 37.99)41.47 (39.72, 43.24)37.72 (35.89, 39.58)37.15 (35.39, 38.95)32.32 (30.27, 34.44)PIR, n(%) < 0.001 Low income14.48 (13.22, 15.83)18.19 (16.48, 20.04)16.31 (14.68, 18.09)14.91 (13.37, 16.59)9.99 (8.84, 11.27) Middle income35.56 (34.03, 37.12)39.06 (36.93, 41.24)38.78 (36.55, 41.05)33.93 (31.80, 36.13)31.74 (29.68, 33.88) High income49.96 (47.67, 52.25)42.75 (40.00, 45.54)44.91 (42.04, 47.83)51.16 (48.33, 53.99)58.27 (55.58, 60.91)Smoking, n(%)0.094 No55.56 (54.16, 56.95)53.60 (51.61, 55.58)56.24 (54.19, 58.27)56.05 (53.94, 58.14)56.11 (54.15, 58.04) Yes44.44 (43.05, 45.84)46.40 (44.42, 48.39)43.76 (41.73, 45.81)43.95 (41.86, 46.06)43.89 (41.96, 45.85)Drinking, n(%) 0.001 No21.97 (20.58, 23.42)22.50 (20.49, 24.63)23.76 (21.66, 25.99)22.46 (20.74, 24.29)19.82 (18.14, 21.61) Yes78.03 (76.58, 79.42)77.50 (75.37, 79.51)76.24 (74.01, 78.34)77.54 (75.71, 79.26)80.18 (78.39, 81.86)Hypertension, n(%) 0.048 No69.27 (68.08, 70.43)67.29 (65.55, 68.97)69.29 (67.35, 71.16)70.08 (68.22, 71.87)70.11 (68.31, 71.84) Yes30.73 (29.57, 31.92)32.71 (31.03, 34.45)30.71 (28.84, 32.65)29.92 (28.13, 31.78)29.89 (28.16, 31.69)Diabetes, n(%) 0.015 No85.64 (84.83, 86.41)84.07 (82.74, 85.33)85.43 (83.97, 86.78)86.40 (85.11, 87.59)86.37 (85.20, 87.46) Yes14.36 (13.59, 15.17)15.93 (14.67, 17.26)14.57 (13.22, 16.03)13.60 (12.41, 14.89)13.63 (12.54, 14.80)Cancer or malignancy, n(%) < 0.001 No90.26 (89.73, 90.76)91.89 (90.73, 92.92)91.21 (90.03, 92.26)90.16 (89.18, 91.07)88.39 (87.37, 89.33) Yes9.74 (9.24, 10.27)8.11 (7.08, 9.27)8.79 (7.74, 9.97)9.84 (8.93, 10.82)11.61 (10.67, 12.63)The values are presented as survey-weighted medians (Q1, Q3) for continuous variables and survey-weighted percentages (95% CI) for categorical variables. P values were calculated using survey-weighted linear regression for continuous variables and the survey-weighted chi-square test for categorical variables. Bold values indicate P < 0.05Abbreviations: DI-GM Dietary index for the gut microbiota, PIR Poverty income ratio, BMI Body mass index, Q Quartile Table 1Baseline characteristics of US adults in NHANES 2005–2018 by quartiles of the dietary index for the gut microbiota (DI-GM)VariablesTotal (n = 19278)Q₁(n = 4667)Q2 (n = 4717)Q3 (n = 4465)Q4 (n = 5429) P Age (years), M (Q₁, Q₃)46.00 (32.00, 59.00)44.00 (31.00, 58.00)43.00 (31.00, 57.00)46.00 (33.00, 60.00)50.00 (36.00, 62.00) < 0.001 25-hydroxyvitamin D3 (nmol/L), M (Q₁, Q₃)63.00 (46.40, 79.60)59.52 (42.50, 76.10)61.50 (45.60, 78.10)62.66 (46.20, 79.50)67.40 (50.70, 84.10) < 0.001 epi-25-hydroxyvitamin D3 (nmol/L), M (Q₁, Q₃)3.45 (2.19, 5.10)3.26 (2.00, 4.78)3.42 (2.17, 5.13)3.49 (2.21, 5.08)3.59 (2.37, 5.30) < 0.001 Vitamin D (nmol/L), M (Q₁, Q₃)66.40 (50.10, 83.00)62.40 (45.70, 78.90)65.10 (49.00, 81.00)65.80 (50.30, 82.60)70.90 (54.90, 86.80) < 0.001 Gender, n(%) < 0.001 Female50.26 (49.58, 50.94)45.47 (43.66, 47.30)49.14 (47.57, 50.71)51.20 (49.33, 53.07)53.97 (52.54, 55.39) Male49.74 (49.06, 50.42)54.53 (52.70, 56.34)50.86 (49.29, 52.43)48.80 (46.93, 50.67)46.03 (44.61, 47.46)Race, n(%) < 0.001 Mexican American8.32 (6.72, 10.25)8.85 (7.13, 10.95)10.21 (8.29, 12.52)8.99 (7.18, 11.20)5.95 (4.62, 7.62) Other Hispanic5.38 (4.42, 6.55)6.14 (4.83, 7.79)6.36 (5.06, 7.96)5.06 (4.17, 6.13)4.32 (3.53, 5.28) Non-Hispanic White69.21 (65.98, 72.26)64.28 (60.35, 68.03)65.42 (61.27, 69.34)69.72 (66.39, 72.85)75.39 (72.55, 78.03) Non-Hispanic Black10.35 (8.90, 12.00)14.54 (12.17, 17.27)11.40 (9.60, 13.49)9.69 (8.22, 11.38)6.93 (5.98, 8.01) Other Race6.74 (6.03, 7.54)6.18 (5.28, 7.24)6.62 (5.74, 7.61)6.54 (5.61, 7.62)7.41 (6.40, 8.57)Education level, n(%) < 0.001 ≤ High school37.51 (35.39, 39.67)46.08 (43.67, 48.51)41.35 (38.76, 43.98)36.71 (33.83, 39.68)28.80 (26.32, 31.40) >High school62.49 (60.33, 64.61)53.92 (51.49, 56.33)58.65 (56.02, 61.24)63.29 (60.32, 66.17)71.20 (68.60, 73.68)BMI (kg/m2), n(%) < 0.001 < 2529.44 (28.18, 30.72)25.61 (23.93, 27.36)28.06 (26.17, 30.03)29.43 (27.62, 31.32)33.34 (31.08, 35.68) 25 ~ 3033.77 (32.78, 34.78)32.92 (31.00, 34.90)34.23 (32.50, 35.99)33.41 (31.52, 35.36)34.34 (32.73, 35.98) ≥ 3036.79 (35.61, 37.99)41.47 (39.72, 43.24)37.72 (35.89, 39.58)37.15 (35.39, 38.95)32.32 (30.27, 34.44)PIR, n(%) < 0.001 Low income14.48 (13.22, 15.83)18.19 (16.48, 20.04)16.31 (14.68, 18.09)14.91 (13.37, 16.59)9.99 (8.84, 11.27) Middle income35.56 (34.03, 37.12)39.06 (36.93, 41.24)38.78 (36.55, 41.05)33.93 (31.80, 36.13)31.74 (29.68, 33.88) High income49.96 (47.67, 52.25)42.75 (40.00, 45.54)44.91 (42.04, 47.83)51.16 (48.33, 53.99)58.27 (55.58, 60.91)Smoking, n(%)0.094 No55.56 (54.16, 56.95)53.60 (51.61, 55.58)56.24 (54.19, 58.27)56.05 (53.94, 58.14)56.11 (54.15, 58.04) Yes44.44 (43.05, 45.84)46.40 (44.42, 48.39)43.76 (41.73, 45.81)43.95 (41.86, 46.06)43.89 (41.96, 45.85)Drinking, n(%) 0.001 No21.97 (20.58, 23.42)22.50 (20.49, 24.63)23.76 (21.66, 25.99)22.46 (20.74, 24.29)19.82 (18.14, 21.61) Yes78.03 (76.58, 79.42)77.50 (75.37, 79.51)76.24 (74.01, 78.34)77.54 (75.71, 79.26)80.18 (78.39, 81.86)Hypertension, n(%) 0.048 No69.27 (68.08, 70.43)67.29 (65.55, 68.97)69.29 (67.35, 71.16)70.08 (68.22, 71.87)70.11 (68.31, 71.84) Yes30.73 (29.57, 31.92)32.71 (31.03, 34.45)30.71 (28.84, 32.65)29.92 (28.13, 31.78)29.89 (28.16, 31.69)Diabetes, n(%) 0.015 No85.64 (84.83, 86.41)84.07 (82.74, 85.33)85.43 (83.97, 86.78)86.40 (85.11, 87.59)86.37 (85.20, 87.46) Yes14.36 (13.59, 15.17)15.93 (14.67, 17.26)14.57 (13.22, 16.03)13.60 (12.41, 14.89)13.63 (12.54, 14.80)Cancer or malignancy, n(%) < 0.001 No90.26 (89.73, 90.76)91.89 (90.73, 92.92)91.21 (90.03, 92.26)90.16 (89.18, 91.07)88.39 (87.37, 89.33) Yes9.74 (9.24, 10.27)8.11 (7.08, 9.27)8.79 (7.74, 9.97)9.84 (8.93, 10.82)11.61 (10.67, 12.63)The values are presented as survey-weighted medians (Q1, Q3) for continuous variables and survey-weighted percentages (95% CI) for categorical variables. P values were calculated using survey-weighted linear regression for continuous variables and the survey-weighted chi-square test for categorical variables. Bold values indicate P < 0.05Abbreviations: DI-GM Dietary index for the gut microbiota, PIR Poverty income ratio, BMI Body mass index, Q Quartile Baseline characteristics of US adults in NHANES 2005–2018 by quartiles of the dietary index for the gut microbiota (DI-GM) The values are presented as survey-weighted medians (Q1, Q3) for continuous variables and survey-weighted percentages (95% CI) for categorical variables. P values were calculated using survey-weighted linear regression for continuous variables and the survey-weighted chi-square test for categorical variables. Bold values indicate P < 0.05 Abbreviations: DI-GM Dietary index for the gut microbiota, PIR Poverty income ratio, BMI Body mass index, Q Quartile Relationships of vitamin D and DI-GM levels with all-cause mortality As depicted in Fig. 2, higher levels of 25-hydroxyvitamin D3, total vitamin D, epi-25-hydroxyvitamin D3, and DI-GM were strongly related to a decrease in the risk of all-cause mortality (P < 0.05). Compared with the lowest quartile (Q1), the highest quartile (Q4) of 25-hydroxyvitamin D3 was associated with a 40% lower risk of mortality (HR = 0.60, 95% CI: 0.53–0.68). Similarly, Q4 versus Q1 for epi-25-hydroxyvitamin D3 and total vitamin D were associated with 38% (HR = 0.62, 95% CI: 0.54–0.71) and 43% (HR = 0.57, 95% CI: 0.49–0.65) reductions in mortality risk, respectively. Moreover, each unit increase in DI-GM was associated with a 20% reduction in mortality risk (HR = 0.80, 95% CI: 0.71–0.91). Fig. 2Relationships of vitamin D and DI-GM levels with all-cause mortality among participants. The Non-adjusted model includes no covariates. The adjusted I model adjusts for age, gender, and race. The Adjust II model additionally adjusts for education level; smoking, drinking, hypertension, and diabetes; history of cancer or malignancy; body mass index (BMI); and the family income-poverty ratio (PIR). DI-GM Dietary index for the gut microbiota, Q Quartile Relationships of vitamin D and DI-GM levels with all-cause mortality among participants. The Non-adjusted model includes no covariates. The adjusted I model adjusts for age, gender, and race. The Adjust II model additionally adjusts for education level; smoking, drinking, hypertension, and diabetes; history of cancer or malignancy; body mass index (BMI); and the family income-poverty ratio (PIR). DI-GM Dietary index for the gut microbiota, Q Quartile Association of vitamin D and its metabolites with DI-GM RCS (Fig. 3) indicated that the serum 25-hydroxyvitamin D3, total vitamin D, and epi-25-hydroxyvitamin D3 contents were positively related to the DI-GM score, and this phenomenon was consistently observed across all three vitamin D indicators. As presented in Table 2, the higher quartiles of vitamin D contents were strongly related to DI-GM scores (p for trend < 0.001). Potential confounders (age, gender, race, education, BMI, PIR, smoking status, drinking status, hypertension status, diabetes status, and cancer history) were adjusted in Model II. The effect sizes for the highest quartile (Q4) versus the lowest quartile (Q1) were 0.25 (95% CI: 0.18–0.32) for 25-hydroxyvitamin D3, 0.29 (95% CI: 0.22–0.36) for total vitamin D, and 0.16 (95% CI: 0.09–0.22) for epi-25-hydroxyvitamin D3. Fig. 3Association of vitamin D and its metabolites with DI-GM. Restricted cubic spline (RCS) models illustrating the associations of (A) 25-hydroxyvitamin D3, (B) 3-epi-25-hydroxyvitamin D3, and (C) total vitamin D with DI-GM scores. The model is fitted with 3 knots located at the 10th, 50th, and 90th percentiles. The Y-axis presents the odds ratio (OR) for DI-GM corresponding to any value of vitamin D and its metabolites compared with the individuals at the reference value (50th percentile) of the exposure. The model was adjusted for age, gender, race, education level, body mass index, the family income-to-poverty ratio (PIR), smoking, drinking, hypertension, diabetes, and a history of cancer or malignancy Association of vitamin D and its metabolites with DI-GM. Restricted cubic spline (RCS) models illustrating the associations of (A) 25-hydroxyvitamin D3, (B) 3-epi-25-hydroxyvitamin D3, and (C) total vitamin D with DI-GM scores. The model is fitted with 3 knots located at the 10th, 50th, and 90th percentiles. The Y-axis presents the odds ratio (OR) for DI-GM corresponding to any value of vitamin D and its metabolites compared with the individuals at the reference value (50th percentile) of the exposure. The model was adjusted for age, gender, race, education level, body mass index, the family income-to-poverty ratio (PIR), smoking, drinking, hypertension, diabetes, and a history of cancer or malignancy Table 2Multivariate linear regression examining the associations between vitamin D metabolites and DI-GM among NHANES 2005–2018 participantsExposureNon-adjustedAdjust IAdjust IIP for trend25-hydroxyvitamin D3 (nmol/L)< 0.001 Q1000 Q20.16 (0.10, 0.23)0.11 (0.05, 0.18)0.09 (0.03, 0.16) Q30.32 (0.26, 0.39)0.23 (0.16, 0.30)0.17 (0.10, 0.24) Q40.52 (0.45, 0.58)0.35 (0.28, 0.42)0.25 (0.18, 0.32)epi-25-hydroxyvitamin D3 (nmol/L)< 0.001 Q1000 Q20.14 (0.07, 0.20)0.11 (0.05, 0.17)0.09 (0.03, 0.15) Q30.20 (0.14, 0.27)0.13 (0.07, 0.20)0.09 (0.03, 0.16) Q40.37 (0.30, 0.43)0.23 (0.17, 0.30)0.16 (0.09, 0.22)Vitamin D (nmol/L)< 0.001 Q1000 Q20.20 (0.14, 0.27)0.14 (0.07, 0.20)0.12 (0.05, 0.18) Q30.35 (0.29, 0.42)0.24 (0.17, 0.31)0.18 (0.11, 0.24) Q40.57 (0.51, 0.64)0.39 (0.32, 0.46)0.29 (0.22, 0.36)The data are expressed as β coefficients with 95% confidence intervalsNon-adjusted model: No covariates were includedModel I: Adjusted for age, gender, and raceModel II: Adjusted for age, gender, race, education level, body mass index (BMI), the family income-poverty ratio (PIR), smoking status, drinking status, hypertension status, diabetes status, and history of cancer or malignancyAbbreviations: CI Confidence interval, Q Quartile Table 2Multivariate linear regression examining the associations between vitamin D metabolites and DI-GM among NHANES 2005–2018 participantsExposureNon-adjustedAdjust IAdjust IIP for trend25-hydroxyvitamin D3 (nmol/L)< 0.001 Q1000 Q20.16 (0.10, 0.23)0.11 (0.05, 0.18)0.09 (0.03, 0.16) Q30.32 (0.26, 0.39)0.23 (0.16, 0.30)0.17 (0.10, 0.24) Q40.52 (0.45, 0.58)0.35 (0.28, 0.42)0.25 (0.18, 0.32)epi-25-hydroxyvitamin D3 (nmol/L)< 0.001 Q1000 Q20.14 (0.07, 0.20)0.11 (0.05, 0.17)0.09 (0.03, 0.15) Q30.20 (0.14, 0.27)0.13 (0.07, 0.20)0.09 (0.03, 0.16) Q40.37 (0.30, 0.43)0.23 (0.17, 0.30)0.16 (0.09, 0.22)Vitamin D (nmol/L)< 0.001 Q1000 Q20.20 (0.14, 0.27)0.14 (0.07, 0.20)0.12 (0.05, 0.18) Q30.35 (0.29, 0.42)0.24 (0.17, 0.31)0.18 (0.11, 0.24) Q40.57 (0.51, 0.64)0.39 (0.32, 0.46)0.29 (0.22, 0.36)The data are expressed as β coefficients with 95% confidence intervalsNon-adjusted model: No covariates were includedModel I: Adjusted for age, gender, and raceModel II: Adjusted for age, gender, race, education level, body mass index (BMI), the family income-poverty ratio (PIR), smoking status, drinking status, hypertension status, diabetes status, and history of cancer or malignancyAbbreviations: CI Confidence interval, Q Quartile Multivariate linear regression examining the associations between vitamin D metabolites and DI-GM among NHANES 2005–2018 participants The data are expressed as β coefficients with 95% confidence intervals Non-adjusted model: No covariates were included Model I: Adjusted for age, gender, and race Model II: Adjusted for age, gender, race, education level, body mass index (BMI), the family income-poverty ratio (PIR), smoking status, drinking status, hypertension status, diabetes status, and history of cancer or malignancy Abbreviations: CI Confidence interval, Q Quartile Mediating role of DI-GM As presented in Fig. 4 and Supplementary Tables, serum 25-hydroxyvitamin D3 levels had a significant total impact on mortality risk, with a coefficient of 5.59 (95% CI: 4.22–7.14; P < 0.001). DI-GM also had a significant indirect mediating effect (coefficient: 0.21, 95% CI: 0.08–0.35; P < 0.001), accounting for 3.7% (95% CI: 1.2–7.1) of the total effect. Similarly, for epi-25-hydroxyvitamin D3, the direct effect was significant (coefficient: 5.38, 95% CI: 3.948–6.91; P < 0.001). The other analyses of vitamin D and mortality revealed significant indirect effects via gut microbiota diversity, with a coefficient of 0.232 (95% CI: 0.073–0.378; P < 0.001), representing 4.4% (95% CI: 1.1–8.4) of the total effect. Fig. 4The mediating role of DI-GM in the association of vitamin D and its metabolites with all-cause mortality. The figure illustrates the results of the mediation analysis evaluating whether DI-GM partially mediated the associations between (A) 25-hydroxyvitamin D3, (B) 3-epi-25-hydroxyvitamin D3, and (C) total vitamin D and all-cause mortality. Path models show total, direct, and indirect effects, with coefficients and 95% confidence intervals (CIs) estimated using the product-of-coefficients approach. The model was adjusted for age, gender, race, education level, body mass index, the family income-to-poverty ratio (PIR), smoking, drinking, hypertension, diabetes, and a history of cancer or malignancy The mediating role of DI-GM in the association of vitamin D and its metabolites with all-cause mortality. The figure illustrates the results of the mediation analysis evaluating whether DI-GM partially mediated the associations between (A) 25-hydroxyvitamin D3, (B) 3-epi-25-hydroxyvitamin D3, and (C) total vitamin D and all-cause mortality. Path models show total, direct, and indirect effects, with coefficients and 95% confidence intervals (CIs) estimated using the product-of-coefficients approach. The model was adjusted for age, gender, race, education level, body mass index, the family income-to-poverty ratio (PIR), smoking, drinking, hypertension, diabetes, and a history of cancer or malignancy Subgroup analyses and interactions Subgroup analyses were conducted to examine the associations of 25-hydroxyvitamin D3, total vitamin D, epi-25-hydroxyvitamin D3, and DI-GM with mortality across different strata (Supplementary Fig. 1). Most subgroup associations remained robust after adjusting for confounders (P for interaction > 0.05). Notably, significant interactions were observed between 25-hydroxyvitamin D3 and age (P for interaction = 0.004). While younger individuals (< 38 years) in the highest quartile (Q4) had a significantly lower mortality risk than did those in Q1 (HR = 0.35, 95% CI: 0.14–0.83), the inverse association was even stronger among older individuals (≥ 59 years), with an HR of 0.20 (95% CI: 0.12–0.34) for Q4 vs. Q1. Similarly, the association between total vitamin D and all-cause mortality significantly differed by age (P = 0.005), diabetes status (P = 0.046), and cancer history (P = 0.010). Among individuals with a history of cancer, higher vitamin D levels (Q4 vs. Q1) were associated with a significantly lower risk of mortality (HR = 0.72, 95% CI: 0.59–0.87) (Fig. 5).Fig. 5Interaction effects of vitamin D metabolites on all-cause mortality across subgroups among U.S. adults in NHANES 2005–2018. Hazard ratios (HRs) and 95% confidence intervals (CIs) were estimated using multivariable Cox proportional hazards models. Subgroup analyses were conducted to evaluate the interaction effects between vitamin D metabolites and age tertiles, diabetes status, and cancer/malignant status. The models were adjusted for age, gender, race/ethnicity, education level, body mass index (BMI), poverty income ratio (PIR), smoking status, drinking status, hypertension, diabetes, and history of cancer or malignancy, with the exception of the interaction term. The green dots indicate an HR < 1 (protective association), the red dots indicate an HR > 1 (risk-enhancing association), and the horizontal bars represent 95% CIs. Reference groups are marked accordingly. P values for interactions are shown on the left. Abbreviations: BMI Body mass index, PIR Poverty income ratio, CI Confidence interval, HR Hazard ratio Interaction effects of vitamin D metabolites on all-cause mortality across subgroups among U.S. adults in NHANES 2005–2018. Hazard ratios (HRs) and 95% confidence intervals (CIs) were estimated using multivariable Cox proportional hazards models. Subgroup analyses were conducted to evaluate the interaction effects between vitamin D metabolites and age tertiles, diabetes status, and cancer/malignant status. The models were adjusted for age, gender, race/ethnicity, education level, body mass index (BMI), poverty income ratio (PIR), smoking status, drinking status, hypertension, diabetes, and history of cancer or malignancy, with the exception of the interaction term. The green dots indicate an HR < 1 (protective association), the red dots indicate an HR > 1 (risk-enhancing association), and the horizontal bars represent 95% CIs. Reference groups are marked accordingly. P values for interactions are shown on the left. Abbreviations: BMI Body mass index, PIR Poverty income ratio, CI Confidence interval, HR Hazard ratio Discussion The present study demonstrated that vitamin D and its metabolites (25-hydroxyvitamin D3 and 3-epi-25-hydroxyvitamin D3) were positively related to DI-GM. In addition, DI-GM was confirmed to play a mediating role in the relationship between vitamin D and all-cause mortality. Higher vitamin D levels were related to a reduced risk of mortality, a relationship mediated partially by DI-GM. These results support our hypothesis that higher vitamin D and DI-GM levels are associated with reduced all-cause mortality and that DI-GM partially mediates this relationship. These findings are consistent with the literature that has emphasized the effect of vitamin D in terms of regulating immune and metabolic health. However, while previous research has focused predominantly on the direct effects of vitamin D, the present study extends this framework by uncovering the potential indirect effects mediated through the gut microbiota, thereby providing novel insights into the effects of vitamin D on decreasing mortality risk. The present study revealed a significant inverse relationship of vitamin D and its metabolites (25-hydroxyvitamin D3 and 3-epi-25-hydroxyvitamin D3) with all-cause mortality. Greater levels of vitamin D were related to a decreased risk of mortality, which was consistent with previously reported findings. One study, for example, reported a markedly decreased risk of all-cause mortality in individuals with higher vitamin D contents (≥ 75 nmol/L) (HR: 0.60, 95% CI: 0.49–0.74), whereas lower vitamin D contents were associated with a greater risk of mortality [24]. Certain studies have suggested a potential non-linear relationship between vitamin D and all-cause mortality [25]. The present study, however, revealed no such non-linear relationship, further clarifying the sustained protective effects of higher vitamin D levels. In addition, the present study revealed an inverse relationship between DI-GM and all-cause mortality, which is consistent with the findings of previous studies reporting that the gut microbiota is associated with healthy dietary patterns and, consequently, a reduction in the risk of mortality [26, 27]. Building on this foundation, the present study innovatively extended the framework linking vitamin D and its metabolites to DI-GM to include a mortality analysis, which provided supplementary evidence in support of the improvement effect of vitamin D on survival outcomes through the promotion of gut microbiota health. The study findings, therefore, offer novel scientific insights for the development of precision dietary interventions. The present work revealed that vitamin D and its metabolites (25-hydroxyvitamin D3 and 3-epi-25-hydroxyvitamin D3) were significantly and positively related to DI-GM. This finding confirms the critical effect of vitamin D in terms of regulating the gut microbial composition and functionality. Vitamin D supplementation reportedly enhances intestinal barrier function, reduces the leakage of gut-derived toxins such as lipopolysaccharides, and thereby optimizes the ecological environment of the gut microbiota [28]. Furthermore, vitamin D has been suggested to be involved in the gut microbiota-bile acid axis, a key pathway related to metabolic health [29]. Vitamin D may also increase gut microbiota diversity and stability by promoting the growth of beneficial bacteria, such as those belonging to the Firmicutes phylum, while reducing the abundance of potential pathogens, such as those belonging to the Bacteroidetes phylum [30]. These mechanisms may explain the health benefits observed in individuals with higher DI-GM scores and underscore the pivotal role of vitamin D and its metabolites in modulating gut microbiota function. The present study provided evidence for the associations of vitamin D with the gut microbiota while also providing supplementary data regarding the specific functions of different vitamin D metabolites. The findings of the present study lay a theoretical foundation for future studies that could explore the potential application of vitamin D in gut health interventions. Notably, the present study is the first to reveal the effect of 3-epi-25-hydroxyvitamin D3 on DI-GM modulation, suggesting that vitamin D metabolites interact directly with the gut microbiota to improve gut ecology. The present study revealed that DI-GM partially mediated the relationship between vitamin D and its metabolites with all-cause mortality. This finding suggested a limited role of the gut microbiota in this relationship, which is consistent with existing studies that attributed the mortality-reducing effects of vitamin D to its regulation of immune function and inflammatory responses [31, 32]. Moreover, gut microbial diversity has been closely associated with host health, with high diversity contributing to improved intestinal barrier function, reduced inflammation, and enhanced signaling pathways related to vitamin D [33, 34]. In contrast to previous studies, which emphasized the gut microbiota as a primary regulatory factor, the present study revealed the critical role of vitamin D in directly modulating immune responses and oxidative stress, with the gut microbiota serving as an auxiliary factor. The findings of the present study validated the relationship of vitamin D with the gut microbiota, underscoring the limited mediating effect of the gut microbiota on health outcomes. The present study, therefore, provides a novel perspective on the multifaceted mechanisms by which vitamin D regulates health, paving the way for further exploration into its direct and indirect pathways of influence. The study also revealed that vitamin D and its metabolites demonstrated heterogeneous associations with mortality risk across different subgroups, with particularly notable protective effects observed among individuals with a history of cancer. Although significant interactions with age were detected, the inverse association between vitamin D levels and mortality appeared strongest among older individuals (≥ 59 years), as reflected by the lowest hazard ratios in this group. Individuals with higher vitamin D levels also presented a lower prevalence of diabetes and cancer than those in the lowest DI-GM quartile, which aligns with the literature. These findings further support the role of vitamin D in regulating the gut microbiota, maintaining immune homeostasis, and reducing chronic disease risk [30]. Through the vitamin D receptor, vitamin D modulates immune cell and epithelial cell functions, thereby enhancing intestinal barrier integrity and preventing microbial translocation [35]. These mechanisms may help explain the observed reduction in mortality risk among subgroups with specific health conditions. In particular, the improved prognosis in individuals with a history of cancer may be attributable to the immunomodulatory and anti-tumor effects of vitamin D, including the inhibition of cancer progression, reduction in inflammation, and enhancement of anti-tumor immunity [36, 37]. The present study provides several innovative contributions and supplementary insights. First, by revealing the relationships of vitamin D and its metabolites with DI-GM, the findings of this study corroborated the indirect relationship between vitamin D and mortality risk. Second, the study demonstrated that the gut microbiota mediates the vitamin D mechanism, underscoring the importance of gut health during dietary and nutritional interventions. Finally, the subgroup analyses revealed that the protective effect of vitamin D was heterogeneous. These findings provide a scientific basis for developing precise intervention strategies tailored to specific populations. Nonetheless, the present study has certain limitations. This study has several limitations. First, the DI-GM was derived from self-reported 24-h dietary recall data rather than direct microbiome sequencing data, which may introduce measurement error and limit the precision in reflecting the gut microbial composition and function. Second, although we adjusted for a wide range of demographic, lifestyle, and clinical covariates, residual confounding factors from unmeasured factors—such as vitamin D supplement use, seasonal variation in blood collection, physical activity, and the use of medications that influence vitamin D metabolism (e.g., statins or anticonvulsants)—cannot be fully excluded. In addition, the percentage of DI-GM-mediated effects on the vitamin D-mortality relationship was less than 10%, suggesting a limited explanatory role of the gut microbiota in this pathway. Furthermore, vitamin D metabolites were measured at a single time point without repeated assessments, which may limit causal inference. Additionally, the potential for reverse causation exists, as low vitamin D levels may reflect underlying illness rather than causally contributing to mortality. However, the prospective cohort design, with a median follow-up of approximately 7 years, helps mitigate this concern. Future studies should incorporate longitudinal microbiome sequencing and more comprehensive exposure assessments to validate our findings and elucidate the underlying mechanisms involved. Conclusions These findings suggest that vitamin D and DI-GM, as surrogate measures based on dietary patterns rather than direct sequencing, are important factors for reducing mortality. Subgroup analyses further revealed that this association was more pronounced among individuals with a history of cancer. While interactions with age were statistically significant, the strongest inverse associations were observed in older individuals. These findings suggest that vitamin D and gut microbiota-related dietary patterns may contribute to reduced mortality risk, particularly in specific high-risk subpopulations. Supplementary Information Supplementary Material 1. Supplementary Material 1.