Infertility is a distressing health condition that has diverse effects on couples’ lives. One of the most affected aspects of life in infertile women is sexual function, which is a key factor in physical and marital health. The goal of this study was to evaluate sexual function according to the type of infertility in comparison with controls. In this study, 191 women with primary infertility and 129 with secondary infertility along with 87 age-matched healthy controls were enrolled. They were asked to fill a valid and reliable FSFI (Female Sexual Function Index). Age, partner age and duration of marriage were significantly different between the primary and secondary infertility groups. The score of each FSFI domain was significantly higher in the control group, and the only significant difference between primary and secondary infertility groups was in the desire domain. Multiple linear regression analysis between the total FSFI score as a dependent variable and age, partner age, Body Mass Index and marriage duration as independent variables showed that age is a dependent predictor of FSFI in the primary group. We found significant negative correlation between total FSFI score and age, partner age and marriage duration (r1= -0.21 and P<0.001, r2=-0.14 and P=0.01, r3=-0.19 and P<0.001). Sexual dysfunction is high in all infertile women, and women with secondary infertility suffer more from impaired sexual function compared with those with primary infertility.