Relying on an extremely rich data set of individuals living in Madrid in 1880 and 1905, this article explores the relationship between class, access to education and social mobility. In order to do so, we first focus on children and assess the probability of being literate according to their parents’ socio-economic status. We find an extremely wide educational gap in 1880. Although this difference declined in the following years, it was still considerable in 1905. Given that we have information on where this children lived and the location of public schools, we then explore how the expansion of the supply of schools during this period may have improved access to education of children from disadvantaged backgrounds. Lastly, we analyse the returns to education by studying social mobility. In this regard, we have matched the children existing in our sample in 1880 with their corresponding adult-selves in 1905, 25 years later, using record linkage techniques. Preliminary results show that getting literate enhanced children’s chances of moving up the social ladder.