Forty patients with the acquired immunodeficiency syndrome (AIDS) and their first episodes of Pneumocystis carinii pneumonia were assigned at random to receive either trimethoprim-sulfamethoxazole or pentamidine isethionate. The two groups did not differ significantly in the severity of pulmonary or systemic processes at enrollment. Five patients treated initially with trimethoprim-sulfamethoxazole and one patient treated initially with pentamidine died during the 21-day treatment period (p = 0.09, Fisher's exact test). No significant differences were seen between groups in rates of improvement, pulmonary function tests, or 67Ga uptake by the lungs in the survivors at completion of therapy. Adverse reactions necessitated changing from the initial drug in 10 patients in the trimethoprim-sulfamethoxazole group and 11 in the pentamidine group. Minor reactions occurred in all patients. In patients with AIDS, trimethoprim-sulfamethoxazole and pentamidine do not have statistically significant differences in efficacy or frequency of adverse reactions.