Healthcare costs tend to increase with age. In particular, in the case of illness, the last year before death can be an exceptionally costly period as the need for healthcare increases. Using a novel private insurance dataset containing over one million records of claims submitted by individuals to their health insurance providers during the last year of life, our research seeks to shed light on the costs before death in Switzerland. Our work documents how spending patterns change with proximity to dying. We use machine learning algorithms to identify and quantify the key effects that drive a person’s spending during this critical period. Our findings provide a more profound understanding of the costs associated with hospitalization before death, the role of age, and the variation in costs based on the services, including care services, which individuals require.