BackgroundIt is known that caregivers are more likely to be depressed compared to those without caregiving burden. The disappearance of caregiving burden after widowhood may alleviate depression, but at the same time the diminishment of marital resources caused by widowhood may exacerbate depression. So, what effect does widowhood have on depression among caregivers?, which was valuable for promoting the mental health of caregivers in the context of China’s aging.MethodsChina Health and Retirement Longitudinal Study (CHARLS), a longitudinal data, was selected and the effect of widowhood on depression among middle-aged and elderly caregivers was explored by using Ordinary Least Squares and Propensity Score Matching methods based on 2018 CHARLS data. The channels and subgroup difference were also analyzed.ResultsWidowhood significantly increased CES-D scores of caregivers, and there were higher CES-D scores among women, the middle-aged, rural residents, and those with higher levels of education. Widowhood increased depression of caregivers through reducing personal economic resources, and increasing possibilities to live with children and participate in social activities.ConclusionsCaregivers who experienced widowhood tend to be depressed and concerted efforts are needed. On the one hand, more social security measures and economic subsidy policy should focus on the middle-aged adults and elderly who experienced widowhood. On the other one hand, it is helpful to relieve depression by providing more social support from society and families to the middle-aged adults and elderly who experienced widowhood.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12913-023-09746-4.