ImportanceNearly 10% of the 1.5 million persons residing in nursing homes (NHs) have received or will receive a diagnosis of cancer. Although aggressive end-of-life (EOL) care is common among community-dwelling patients with cancer, little is known about such patterns of care among NH residents with cancer.ObjectiveTo compare markers of aggressive EOL care between older adults with metastatic cancer who are NH residents and their community-dwelling counterparts.Design, Setting, and ParticipantsThis cohort study used the Surveillance, Epidemiology, and End Results database linked with the Medicare database and the Minimum Data Set (including NH clinical assessment data) for deaths occurring from January 1, 2013, to December 31, 2017, among 146 329 older patients with metastatic breast, colorectal, lung, pancreas, or prostate cancer, with a lookback period in claims data through July 1, 2012. Statistical analysis was conducted between March 2021 and September 2022.ExposuresNursing home status.Main Outcomes and MeasuresMarkers of aggressive EOL care were cancer-directed treatment, intensive care unit admission, more than 1 emergency department visit or more than 1 hospitalization in the last 30 days of life, hospice enrollment in the last 3 days of life, and in-hospital death.ResultsThe study population included 146 329 patients 66 years of age or older (mean [SD] age, 78.2 [7.3] years; 51.9% men). Aggressive EOL care was more common among NH residents than community-dwelling residents (63.6% vs 58.3%). Nursing home status was associated with 4% higher odds of receiving aggressive EOL care (adjusted odds ratio [aOR], 1.04 [95% CI, 1.02-1.07]), 6% higher odds of more than 1 hospital admission in the last 30 days of life (aOR, 1.06 [95% CI, 1.02-1.10]), and 61% higher odds of dying in the hospital (aOR, 1.61 [95% CI, 1.57-1.65]). Conversely, NH status was associated with lower odds of receiving cancer-directed treatment (aOR, 0.57 [95% CI, 0.55-0.58]), intensive care unit admission (aOR, 0.82 [95% CI, 0.79-0.84]), or enrollment in hospice in the last 3 days of life (aOR, 0.89 [95% CI, 0.86-0.92]).Conclusions and RelevanceDespite increased emphasis to reduce aggressive EOL care in the past several decades, such care remains common among older persons with metastatic cancer and is slightly more prevalent among NH residents than their community-dwelling counterparts. Multilevel interventions to decrease aggressive EOL care should target the main factors associated with its prevalence, including hospital admissions in the last 30 days of life and in-hospital death.