Introduction: The objective of this study was to determine the relationship between clinical/socio-demographic factors with knowledge and attitude on sex among medical students of the National University of Malaysia (UKM). Methods: A cross-sectional study assessing 452 students using a selfadministered questionnaire of knowledge and attitude was performed and had a response rate of 80%. Results: The majority of respondents were Malays (56%), females (57.5%), lived in urban areas (66.4%), had a median family income of RM3000 and perceived themselves as moderately religious (60%). The overall score on knowledge about sex was 21.7 of 35 (a higher score indicates better knowledge about sex). It was noted that 73.2% of students felt that they did not receive adequate training in medical school to deal with patients' sexuality and sexual problems, while 51.5% felt uncomfortable talking to patients about these issues. Students in the clinical year were more knowledgeable than those in pre-clinical years (22.67 versus 20.71, P < 0.001). No significant differences were found in terms of their backgrounds, such as being from urban or rural areas (P = 0.349) and between genders (P = 0.286). Only 54.9% of students had a satisfactory level of knowledge on sex (>22 marks [median score]). Discussion: The students' attitude on sex was considered conservative as the majority of them disagreed on premarital sex, masturbation, abortion, homosexuality and oral sex. Gender and religiosity have a large influence on attitudes on controversial sexual issues, whereas clinical status plays a small role. Knowledge on sex among UKM medical students is inadequate and their attitudes on sex are considered conservative. Integration of sexual medicine and health modules in the medical curriculum is crucial for students to more effectively address patients' sexual problems and promote non-judgmental attitudes towards patients.