To assess the prevalence and associated risk factors for human immunodeficiency virus (HIV) infection in patients attending inner-city clinics for sexually transmitted diseases in Baltimore, we screened 4028 patients anonymously, of whom 209 (5.2 percent) were seropositive for HIV. HIV-seropositivity rates were higher among men (6.3 percent) than women (3.0 percent) (P less than 0.001) and among blacks (5.0 percent) than whites (1.2 percent) (P less than 0.02). Among men, but not women, HIV seroprevalence increased markedly and steadily up to the age of 40. In men, HIV seropositivity was independently associated with increased age, black race, a history of homosexual contact, and the use of parenteral drugs. In women, a history of parenteral drug use or of being a sexual partner of a bisexual man or parenteral drug user were independently predictive of HIV seropositivity. In men, HIV seropositivity was also associated with a history of syphilis or a reactive serologic test for syphilis, and in women, with a history of genital warts. Since these associations were independent of the type and number of reported sexual partners, they raise the possibility that sexually transmitted diseases that disrupt epithelial surfaces may be important in the transmissibility of HIV. In addition, on a self-administered questionnaire, one third of HIV-infected men and one half of infected women did not acknowledge previous high-risk behavior for HIV exposure. These data suggest that patients at clinics for sexually transmitted diseases represent a group at high risk for HIV infection, and that screening, counseling, and intensive education should be offered to all patients attending such clinics.