We study cross-country differences in rural and urban educational attainment by using a data set comprising 56 countries. We focus on the determinants of rural–urban educational inequality, which is measured by the ratio of rural to urban average years of schooling within each country. We find that riskier human capital investment, less credit availability, a colonial heritage, a legal system of French origin and landlockedness of nations are all associated with relatively lower rural educational levels and greater rural–urban educational inequality. Conversely, larger formal labor markets, better infrastructure and a legal system of British origin are associated with relatively higher rural educational levels and lower rural–urban educational inequality. We also identify an interaction effect between economic development level and some of these factors. In particular, we find that as development level increases, the negative (positive) relationship between French (British) legal systems and rural–urban educational inequality is reversed and becomes positive (negative).