Objective To explore the correlations between the nutritional status, depression, and quality of life in elderly inpatients, as well as the mediation effect of the nutritional status between depression and quality of life. Methods By the convenience sampling method, 143 elderly inpatients who received treatment in the Geriatrics Department of a Class A tertiary hospital in Nanning from July 2021 to March 2023 were selected as the research subjects. The general information of the patients was collected by a general information questionnaire. The Mini Nutritional Assessment (MNA), the Geriatric Depression Scale (GDS), and the EuroQol Visual Analogue Scale (EQ VAS) were used to evaluate the patients' nutritional status, depressive state, and quality of life, respectively. The Pearson correlation analysis was used to explore the correlations between the nutritional status, depression, and quality of life in elderly inpatients. The mediation effect test method (Bootstrap method) proposed by Wen Zhonglin and others was adopted to analyse the mediation effect of the nutritional status between the depression and the quality of life in elderly inpatients. Results The MNA score of the 143 elderly inpatients was (22.35±4.34) points, the GDS score was (3.14±4.29) points, and the EQ VAS score was (91.52±9.76) points. The MNA score was negatively correlated with the GDS score (r=-0.408, P<0.001) and positively correlated with the EQ VAS score (r=0.465, P<0.001); the GDS score was negatively correlated with the EQ VAS score (r=-0.417, P<0.001). Nutritional status partially mediated the correlation between depression and quality of life, with a proportion of mediation up to 34.49%. Conclusion The nutritional status plays a partial mediating role between depression and quality of life in elderly inpatients, and improving the nutritional status can indirectly enhance their quality of life.