background: mental health of caregivers is damaged by caregiving tasks. studies are needed to determine the influence of several variables on the association between informal care and mental health. the aim of this paper is to analyse the effects of the time devoted to informal caregiving on the mental health of women and men in relation to the type of dependents. methods: national health survey 2006, sample 29,478. variables: mental health state (ghq-12), number of hours devoted to caregiving, age, social class, and functional support (duke-unc). a logistic regression analysis was performed to determine the probability of having poorer mental health according to the number of hours of caregiving, adjusted for age, social class and functional support. results: women show poorer mental health when they spend more than 97 hours per week taking care of children [or=1,372], more than 25 hours caring for persons over 74 years of age [or=1,602 between 25 and 48 hours; or=1,467 49-96h.; or=1,874 97-168h.], and when they devote some hours to provide care to adults with disabilities [or=1,996 0-24h.; or=2,507 25-48h.; or=3,016 49-96h.; or=1,651 97-168h.]. men show deterioration in mental health when they devote a high number of hours to caring for persons over 74 years [or=2,810 97-168h.] and adults with disabilities [or=3,411 97-168h.], and when they devote some hours to childcare [or=1,595 0-24h.]. conclusions: the effect of the number of hours devoted to caregiving on the mental health of caregivers is influenced by the type of dependents and the gender of the caregiver.