Health-care providers in China are facing an exponential increase in HIV testing and HIV-positive patients. A total of 1101 service providers were recruited to examine attitudes toward people living with HIV/AIDS (PLWHA) in China. Logistic regression models were used to assess factors associated with providers' attitudes toward mandatory HIV testing. Providers were most likely to endorse mandatory HIV testing for patients with high-risk behaviour and for all patients before surgery. Over 43% of providers endorsed mandatory testing for anyone admitted to hospital. Controlling for demographics, multivariate analyses indicated that providers with higher perceived risk of HIV infection at work, higher general prejudicial attitudes toward PLWHA, and previous contact with HIV patients were more likely to endorse mandatory HIV testing for anyone admitted to hospital. Results underscore the importance of implementing universal precautions in health-care settings and call attention to social and ethical issues associated with HIV/AIDS control and treatment in China.