A total of 100 consecutive patients with AIDS were evaluated for efficacy and safety of treatment and secondary prophylaxis directed against Pneumocystis carinii pneumonia (PCP). 89 episodes of PCP were recorded in 75 patients. 63 of the 75 patients (84%) with a first episode of PCP were discharged. Of 72 patients with a first episode of PCP who were initially treated with trimethoprim-sulfamethoxazole. 76% completed therapy successfully. Side effects were common, but generally mild and tolerated during continued treatment. 7/11 patients (64%) with a first episode of PCP who required mechanical ventilation were discharged. Long term prognosis for these patients was not worse than for patients who did not require mechanical ventilation. Relapse of PCP occurred in 3/50 patients (6%) during secondary prophylaxis, 160 mg trimethoprim and 800 mg sulfamethoxazole (TMP-SMZ) every 24 h, compared to 11/16 (69%) patients who were not receiving prophylaxis (p less than 0.00001). No patients discontinued prophylaxis because of side effects. It is concluded that for most patients with AIDS and PCP, treatment and secondary prophylaxis with TMP-SMZ is safe and effective.