In a prospective, randomized, double-blind trial, 149 patients with advanced human immunodeficiency virus (HIV) infection were randomized to receive itraconazole capsules (200 mg daily) and 146 to receive a matched placebo. Both groups were monitored for evidence of fungal infections. Baseline characteristics of the two groups were similar. Failure of prophylaxis occurred in 29 (19%) of the itraconazole recipients and 42 (29%) of the placebo recipients (P = .004; log-rank test). There were 6 invasive fungal infections in the itraconazole group (4, histoplasmosis; 1, cryptococcosis; 1, aspergillosis) and 19 in the placebo group (10, histoplasmosis; 8, cryptococcosis; 1, aspergillosis) (P = .0007; log-rank test). Itraconazole significantly delayed time to onset of histoplasmosis (P = .03; log-rank test) and cryptococcosis (P = .0005; log-rank test). Prophylaxis failure due to recurrent or refractory mucosal candidiasis occurred with similar frequency in the two groups (itraconazole, 15%; placebo, 16%). A survival benefit was not demonstrated. Itraconazole generally was well tolerated. Primary prophylaxis with itraconazole capsules prevents histoplasmosis and cryptococcosis in patients with HIV infection.