Objective: To investigate the epidemiology and hospitalization costs of pediatric community-acquired pneumonia (CAP) in Shanghai. Methods: A retrospective case summary was conducted on 63 614 hospitalized children with CAP in 59 public hospitals in Shanghai from January 2018 to December 2020. These children's medical records, including their basic information, diagnosis, procedures, and costs, were extracted. According to the medical institutions they were admitted, the patients were divided into the children's hospital group, the tertiary general hospital group and the secondary hospital group; according to the age, they were divided into <1 year old group, 1-<3 years old group, 3-<6 years old group, 6-<12 years old group and 12-18 years old group; according to the CAP severity, they were divided into severe pneumonia group and non-severe pneumonia group; according to whether an operation was conducted, the patients were divided into the operation group and the non-operation group. The epidemiological characteristics and hospitalization costs were compared among the groups. The χ2 test or Wilcoxon rank sum test was used for the comparisons between two groups as appropriate, and the Kruskal-Wallis H test was conducted for comparisons among multiple groups. Results: A total of 63 614 hospitalized children with CAP were enrolled, including 34 243 males and 29 371 females. Their visiting age was 4 (2, 6) years. The length of stay was 6 (5, 8) days. There were 17 974 cases(28.3%) in the secondary hospital group, 35 331 cases (55.5%) in the tertiary general hospital group and 10 309 cases (16.2%) in the children's hospital group. Compared with the hospitalizations cases in 2018 (27 943), the cases in 2019 (29 009) increased by 3.8% (1 066/27 943), while sharply declined by 76.2% (21 281/27 943) in 2020 (6 662). There were significant differences in the proportion of patients from other provinces and severe pneumonia cases, and the hospitalization costs among the children's hospital, secondary hospital and tertiary general hospital (7 146 cases(69.3%) vs. 2 202 cases (12.3%) vs. 9 598 cases (27.2%), 6 929 cases (67.2%) vs. 2 270 cases (12.6%) vs. 9 397 cases (26.6%), 8 304 (6 261, 11 219) vs. 1 882 (1 304, 2 796) vs. 3 195 (2 364, 4 352) CNY, χ2=10 462.50, 9 702.26, 28 037.23, all P<0.001). The annual total hospitalization costs of pediatric CAP from 2018 to 2020 were 110 million CNY, 130 million CNY and 40 million CNY, respectively. And the cost for each hospitalization increased year by year, which was 2 940 (1 939, 4 438), 3 215 (2 126, 5 011) and 3 673 (2 274, 6 975) CNY, respectively. There were also significant differences in the hospitalization expenses in the different age groups of <1 year old, 1-<3 years old, 3-<6 years old, 6-<12 years old and 12-18 years old (5 941 (2 787, 9 247) vs. 2 793 (1 803, 4 336) vs. 3 013 (2 070, 4 329) vs. 3 473 (2 400, 5 097) vs. 4 290 (2 837, 7 314) CNY, χ2=3 462.39, P<0.001). The hospitalization cost of severe pneumonia was significantly higher than that of non-severe cases (5 076 (3 250, 8 364) vs. 2 685 (1 780, 3 843) CNY, Z=109.77, P<0.001). The cost of patients who received operation was significantly higher than that of whom did not (10 040 (4 583, 14 308) vs. 3 083 (2 025, 4 747) CNY, Z=44.46, P<0.001). Conclusions: The number of children hospitalized with CAP in Shanghai decreased significantly in 2020 was significantly lower than that in 2018 and 2019.The proportion of patients from other provinces and with severe pneumonia are mainly admitted in children's hospitals. Hospitalization costs are higher in children's hospitals, and also for children younger than 1 year old, severe cases and patients undergoing operations.