In this paper, we investigate the effect of student exposure to homicides on their educational performance and human capital investments. Combining a number of large georeferenced administrative datasets from Brazil, we estimate the effect of exposure to homicides in the public way on these outcomes. Using within-school and within-corridor estimates, we show that violence in the surroundings of schools has a detrimental effect on school attendance and on standardised test scores in math and Portuguese language and increases dropout rates. We construct measures of student exposure to homicides on their way from home to school and find that exposure on the school path increases dropout rates substantially. Exceptionally rich data on student- and parent-reported aspirations and attitudes towards education allow us to explore the channels underlying these effects.