The historical extraction of natural gas and oil in the United States (U.S.) has led to the drilling of millions of wells since the inception of the Drake oil well in Pennsylvania in 1859. A significant portion of these wells remain undocumented, posing potential risks to public health, safety, and the environment due to their unknown locations and conditions. To address this issue, we developed a methodology to estimate the number and spatial distribution of undocumented orphan wells (UOWs) at the state and county levels, leveraging publicly accessible historical well and production data. Applying this methodology to Pennsylvania and Oklahoma, we identified approximately 340,827 UOWs in Pennsylvania and 309,462 in Oklahoma, considering underreporting and enhanced oil recovery activities. We also highlight specific counties, such as Osage and Creek County in Oklahoma and McKean County in Pennsylvania, with over 30,000 UOWs in each county. We validated our results with proprietary databases (Pennsylvania Department of Environmental Protection (PA DEP) historical well and Enverus) and a previous aeromagnetic survey, which found at least two UOWs for every documented well in three large areas of western Pennsylvania. Our method could estimate UOWs nationwide, supporting the initiation of state and federal programs to mitigate health risks from these wells. Synopsis Legacy wells cause severe environmental pollution and health risks to the U.S. This study proposes a workflow to locate these wells at the county level and mitigate those risks.