Background: To investigate the use of do-not-resuscitate (DNR) orders in patients hospitalized with community-acquired pneumonia (CAP) and the association with mortality. Methods: We assembled a cohort of 1317 adults hospitalized with radiographically confirmed CAP in three Danish hospitals. Patients were grouped into no DNR order, early DNR order (≤48 h after admission), and late DNR order (> 48 h after admission). We tested for associations between a DNR order and mortality using a cox proportional hazard model adjusted for patient and disease related factors. Results: Among 1317 patients 177 (13%) patients received a DNR order: 107 (8%) early and 70 (5%) late, during admission. Patients with a DNR order were older (82 years vs. 70 years, p < 0.001), more frequently nursing home residents (41% vs. 6%, p < 0.001) and had more comorbidities (one or more comorbidities: 73% vs. 59%, p < 0.001). The 30-day mortality was 62% and 4% in patients with and without a DNR order, respectively. DNR orders were associated with increased risk of 30-day mortality after adjustment for age, nursing home residency and comorbidities. The association was modified by the CURB-65 score Hazard ratio (HR) 39.3 (95% CI 13.9-110.6), HR 24.0 (95% CI 11.9-48,3) and HR 9.4 (95% CI: 4.7-18.6) for CURB-65 score 0-1, 2 and 3-5, respectively. Conclusion: In this representative Danish cohort, 13% of patients hospitalized with CAP received a DNR order. DNR orders were associated with higher mortality after adjustment for clinical risk factors. Thus, we encourage researcher to take DNR orders into account as potential confounder when reporting CAP associated mortality.