We analyzed cross-sectional data from 1062 homosexual men recruited in Baltimore during 1984, to directly compare risk factors for human immunodeficiency virus (HIV) and hepatitis B virus (HBV). Using polychotomous logistic regression, risk factor odds ratios (ORs) and 95% confidence intervals were determined for men with HIV alone, men with HBV alone, and men with both HIV and HBV, compared to seronegative men, and paired comparisons among these subgroups. Factors associated with the serologic prevalence of HIV alone and HBV alone (with respective ORs) included and receptive intercourse (HIV OR = 1.23; HBV OR = 1.12), history of gonorrhea (HIV OR = 4.58; HBV OR = 2.52), and rectal douching (HIV OR = 1.41; HBV OR = 1.20). Additional factors associated with HBV alone were years of homosexual activity (OR = 1.65), sexual activity with a person who developed acquired immunodeficiency syndrome (AIDS) (OR = 1.98), and lifetime number of male sex partners (OR = 1.25). HIV and HBV coprevalence was associated with anal receptive intercourse (OR = 1.36), history of gonorrhea (OR = 2.94), rectal douching (OR = 1.45), sexual activity with a person who developed AIDS (OR = 3.87), lifetime number of male sex partners (OR = 1.21), and the lifetime sum of sexually transmitted diseases (OR = 1.47). These findings reinforce the need for following safer-sex guidelines to prevent both infections and in the case of HBV, the prevention strategies should include vaccination.