A rapid diagnosis of pneumococcal pneumonia may allow the earlier use of narrow-spectrum antimicrobial therapy. It is unknown, however, whether rapid diagnostic testing of patients hospitalized with community-acquired pneumonia (CAP) admitted to hospital lowers costs. Therefore, an algorithm to calculate the costs associated with the diagnosis and treatment of CAP was formulated. Subsequently, the algorithm was applied to clinical data for 122 consecutively admitted patients with CAP whose sputum samples were Gram stained and whose urine was tested for Streptococcus pneumoniae antigen. The costs of initial antimicrobial therapy, personnel, and materials were measured. Compared to the most expensive empirical regimen, rapid diagnostic testing would result in cost savings per patient (PP) of 3.51 Euros for Gram staining and 8.11 Euros for urinary pneumococcal antigen testing (1 Euro is equal to 1.13 US dollars, from 2000 to 2002). Compared to the cheapest regimen, Gram staining would increase the cost by 2.25 Euros PP, and urinary antigen testing would increase the cost by 24.26 Euros PP. In our setting, the use of rapid diagnostic testing would not lower costs. Cost savings depend, however, on the differences in the prices of the different antibiotics chosen and the proportion of evaluable and positive samples.