HIV prevalence is increasing in China. The proportion of infection attributable to heterosexual sex in China is also on the rise. The scale of internal migration for work is likely to be one of the factors contributing to these changing patterns, but little is known about HIV-related knowledge, perceptions and risk behaviours of China's migrant workers. This study aimed to investigate HIV-related knowledge, attitudes and risk behaviours of male rural-to-urban migrant workers in Chengdu and to identify factors associated with risk behaviours. In 2005, a cross-sectional questionnaire survey was completed by 163 male construction- and factory-based migrant workers aged 18-35 years. With a mean age of 26 years, just 30% had completed senior middle school and 47% were currently married. Respondents were highly mobile, worked long hours and were relatively poorly paid. As migrants, their access to urban services and benefits was restricted, making it difficult for family members to join them. Knowledge of HIV transmission was generally poor and discriminatory attitudes towards people with HIV were commonplace. Seventy-five percent were sexually experienced, among whom 88% had had sexual relations in the last 12 months. Of these, 30% had had two or more partners and 20% had paid for sex. Just 36% had used a condom during the most recent sexual encounter with a sex worker. Around 70% thought it was 'impossible' for them to become infected, yet a significant sub-group were engaging in sexual behaviours that place them at risk of infection with HIV and sexually transmitted infections (STIs). Logistic Regression found a significant association between having multiple sexual partners and both education level and marital status. Education was also found to be significantly associated with purchasing sex. Targeted HIV-prevention programs for male migrant workers in Chengdu, especially for those who are single and less educated, are urgently needed.