This study evaluated voluntary testing for human immunodeficiency virus (HIV) in a prison population with a high HIV seroprevalence. Data on demographic variables and participation in voluntary testing were linked to a blinded HIV serosurvey of consecutive Maryland prison entrants (April-July 1991). Among 2,842 entrants, HIV seroprevalence was 8.5% (men, 7.9%; women, 15.3%). Voluntary testing was accepted by 47% of the entrants, and it identified 34% of the HIV-seropositive inmates detected by serosurvey. Refusers of testing were more likely to test HIV-seropositive than were accepters (adjusted odds ratio (OR) = 1.84, 95% confidence interval (CI) 1.58-2.16). Refusers and accepters of testing had similar risk factors for HIV infection, chiefly current syphilis infection (adjusted OR = 5.96, 95% CI 3.15-10.27) and prior injected drug use (adjusted OR = 4.26, 95% CI 3.15-5.76). Among 100 entrants asked why they refused testing, primary reasons given included low risk of HIV, fear of testing HIV-seropositive, and lack of interest. Voluntary testing appears only moderately successful in identifying HIV-seropositive inmates in a high-seroprevalence prison population. However, the alternative, mandatory HIV testing of prisoners, can be construed as discriminatory and unethical when similar screening is not imposed on the population at large. Data presented here suggest strategies to improve acceptance of voluntary testing, especially by high risk inmates.