A study of knowledge, attitudes and practices (KAP) of voluntary HIV counseling and testing (VCT) among rural migrants was conducted in Shanghai, China. An anonymous questionnaire was administered face-to-face. Among 2,690 participants, 78% reported having had lifetime sexual intercourse with 41.3% of singles reporting sexual intercourse, 9.2% having had multiple sex partners in the past year, only 19% of the participants always using condoms whereas 61.6% did not use in their sexual acts in the past month, 80% knew HIV infection was diagnosed through a blood test, 46.5% had heard of VCT ever before, but only 3.5% felt that they were likely to be HIV-infected now or in the future and only 62 (2.3%) had ever had HIV testing with 19 of them getting tested at a VCT site. Gender, working venue, multiple sex partnerships and knowledge of VCT were independently correlated with having had HIV testing. This study suggests that a much greater effort is needed to promote safer sex and to improve VCT knowledge and services among rural migrants particularly those who are engaging in risky behaviors.