A large literature argues that 19th century European state building entailed the formation of nations - societies not only held together by international borders but by a common identity and culture. We study the effects of building the German Reich through phases of territorial integration, and expansion of transport networks on change towards a overarching German identity in the 19th century. We measure individual-level identity choices by analyzing first names recorded in genealogical data covering more than 10 million individuals, along with birth dates and places. We use the choice of old German instead of religious or foreign names as a proxy for national consciousness. We also develop more neutral measures of cultural homogenization by embedding unique first names into a continuous vector space, and calculating parents’ cultural proximity to Prussia (or any other location in our data). To isolate the causal effects of state building and increasing mobility on these outcomes, we exploit spatio-temporal variation in the territorial expansion of Prussia and the growth of transport networks. The results will contribute to the literature on state and nation building and enhance our understanding of its interaction with cultural change and ethnic homogenization.