Chronic pain is common, with more than one in five adult Americans reporting having pain daily or on most days. A multi-ancestry genomic analysis in 598,339 military veterans in the USA identifies 126 genetic variants associated with pain intensity, highlights shared genetic risk with substance use and psychiatric disorders, and reveals enrichment in GABAergic neurons as a key molecular contributor to experiencing pain.