Millions of abandoned wells are scattered across the United States, causing significant methane emissions and creating a variety of health and environmental hazards. Governments are increasingly interested in decommissioning such wells via tougher regulations or direct spending, but want to do so efficiently. However, information on the costs of decommissioning wells is very limited. In this analysis, we provide new estimates of the costs of decommissioning oil and gas wells and the key drivers of those costs. We analyze data from up to 19,500 wells and find that median decommissioning costs are roughly $20,000 for plugging only, and $76,000 for plugging and surface reclamation. In rare cases, costs exceed $1 million per well. Each additional 1,000 feet of well depth increases costs by 20 percent, older wells are considerably more costly than newer ones, natural gas wells are nine percent more expensive than wells that produce oil, and costs vary widely by state. Surface characteristics also matter: each additional 10 feet of elevation change in the 5-acre area surrounding the well raises costs by three percent. Finally, we find that contracting in bulk pays off: each additional well per contract reduces decommissioning costs by three percent. These findings suggest that regulators can adjust bonding requirements to better match the characteristics of each well.