The atomic nucleus is made of protons and neutrons (nucleons), which are themselves composed of quarks and gluons. Understanding how the quark–gluon structure of a nucleon bound in an atomic nucleus is modified by the surrounding nucleons is an outstanding challenge. Although evidence for such modification—known as the EMC effect—was first observed over 35 years ago, there is still no generally accepted explanation for its cause1,2,3. Recent observations suggest that the EMC effect is related to close-proximity short-range correlated (SRC) nucleon pairs in nuclei4,5. Here we report simultaneous, high-precision measurements of the EMC effect and SRC abundances. We show that EMC data can be explained by a universal modification of the structure of nucleons in neutron–proton SRC pairs and present a data-driven extraction of the corresponding universal modification function. This implies that in heavier nuclei with many more neutrons than protons, each proton is more likely than each neutron to belong to an SRC pair and hence to have distorted quark structure. This universal modification function will be useful for determining the structure of the free neutron and thereby testing quantum chromodynamics symmetry-breaking mechanisms and may help to discriminate between nuclear physics effects and beyond-the-standard-model effects in neutrino experiments.