We study the correlation between parental gender attitudes and the performance in mathematics of girls using two different approaches and data. First, we identify families with a preference for boys by using fertility stopping rules in a population of households whose children attend public schools in Florida. Girls growing up in a boy-biased family score 3 percentage points lower on math tests when compared to girls raised in other families. Second, we find similar strong effects when we study the correlations between girls' performance in mathematics and maternal gender role attitudes, using evidence from the National Longitudinal Survey of Youth. We conclude that socialization at home can explain a non-trivial part of the observed gender disparities in mathematics performance and document that maternal gender attitudes correlate with those of their children, supporting the hypothesis that preferences transmitted through the family impact children behavior.