ObjectiveThis study focused on the association between WeChat use, the most popular social software in China, and the mental health of middle-aged and older adults.DesignNationwide cross-sectional study.SettingThe China Family Panel Studies (CFPS) database.ParticipantsThe study sample included 11 127 middle-aged and elderly people aged 45 and above identified from the 2020 CFPS database.ResultsWeChat usage was negatively associated with depression (OR: 0.782, p<0.01), as was the WeChat Moments sharing (OR: 0.846, p<0.01). 10.310% of the relationship between WeChat usage and depression came from the effects of interpersonal relationships (5.720%) and social trust (4.590%), with significant indirect effects (B=−0.028, p<0.01). Sixteen per cent of the relationship between WeChat Moments sharing and depression came from the effect of interpersonal relationships (6.800%) and social trust (9.200%), and the indirect effect was also significant (B=−0.032, p<0.01).ConclusionsWeChat use may empower middle-aged and elderly to maintain close social relationships and trust contributing to their mental health.