Background: Viral pneumonia has a high incidence and mortality and often presents with bacterial or fungal infections. However, only a few studies have examined viral infection in immunocompromised patients. In this study, we compared the clinical and etiologic characteristics of viral pneumonia in immunocompetent and immunocompromised patients.Methods: We retrospectively recruited patients hospitalized with viral pneumonia from 6 academic hospitals in China between August 2016 and December 2019. We measured the prevalence of comorbidities, coinfections, nosocomial infections, and in-hospital mortalities.Results: Of the 806 patients, 370 were immunocompromised and 436 were immunocompetent. Cytomegalovirus (CMV) was most common (58.1%) in immunocompromised patients, followed by influenza A virus (IFV-A, 21.4%), respiratory syncytial virus (RSV, 19.2%), and parainfluenza virus (PIV, 7.3%). IFV-A (46.1%) was the most common in immunocompetent patients, followed by RSV (20.6%), adenovirus (AdV, 10.6%), PIV (10.1%), and rhinovirus (HRV, 9.2%). Disease severity and in-hospital mortality of immunocompromised patients were higher than those of immunocompetent patients. Pneumocystis jirovecii pneumonia (PCP) (22.4%), Aspergillus (14.1%) and bacteria (13.8%) were most frequent coinfections in immunocompromised patients as to Aspergillus (10.8%), bacteria (7.1%) and mycoplasma (5.3%) in immunocompetent patients. Viral shedding was significantly longer in immunocompromised patients.Conclusions: Immunocompromised patients have a high frequency of coinfections, and persistent viral shedding makes them contagious for prolonged periods. Most deaths were reported among those with CMV and two-or-more viruses, and we found the same disease severity and prognosis for IFV and non-IFV.