The author reports the results of a study to assess the effectiveness of a trimethoprim-sulfamethoxazole combination as prophylaxis in ventriculostomy or shunting operations. Between 1980 and 1983, 122 patients undergoing shunting procedures were randomly assigned to receive trimethoprim-sulfamethoxazole (Group 1, 62 cases) or a placebo (Group 2, 60 cases). The same regimen was followed at each operation, and the patients were followed for a minimum of 6 months. There was a higher infection rate in the placebo group (14 of 60 patients compared with 4 of 62 patients in the antibiotic group, p less than 0.01). The antibiotic protected against early infections (nine of the 60 patients in Group 2 against none of the patients in Group 1), but not against late infections (four of the 62 in Group 1 compared with five of the 60 in Group 2). During the same period, 52 patients undergoing ventriculostomy only were also randomly assigned to receive trimethoprim-sulfamethoxazole (Group 3) or placebo (Group 4). There were no differences in the infection rates between these groups (one of 25 in Group 3 as against one of 27 in Group 4).