Groundwater wells supply water to billions of people, but they can run dry when water tables decline. Here, we analyzed construction records for ~39 million globally distributed wells. We show that 6 to 20% of wells are no more than 5 meters deeper than the water table, implying that millions of wells are at risk of running dry if groundwater levels decline by only a few meters. Further, newer wells are not being constructed deeper than older wells in some of the places experiencing significant groundwater level declines, suggesting that newer wells are at least as likely to run dry as older wells if groundwater levels continue to decline. Poor water quality in deep aquifers and the high costs of well construction limit the effectiveness of tapping deep groundwater to stave off the loss of access to water as wells run dry.