KRAS is one of the most commonly mutated proteins in cancer, and efforts to directly inhibit its function have been continuing for decades. The most successful of these has been the development of covalent allele-specific inhibitors that trap KRAS G12C in its inactive conformation and suppress tumour growth in patients1–7. Whether inactive-state selective inhibition can be used to therapeutically target non-G12C KRAS mutants remains under investigation. Here we report the discovery and characterization of a non-covalent inhibitor that binds preferentially and with high affinity to the inactive state of KRAS while sparing NRAS and HRAS. Although limited to only a few amino acids, the evolutionary divergence in the GTPase domain of RAS isoforms was sufficient to impart orthosteric and allosteric constraints for KRAS selectivity. The inhibitor blocked nucleotide exchange to prevent the activation of wild-type KRAS and a broad range of KRAS mutants, including G12A/C/D/F/V/S, G13C/D, V14I, L19F, Q22K, D33E, Q61H, K117N and A146V/T. Inhibition of downstream signalling and proliferation was restricted to cancer cells harbouring mutant KRAS, and drug treatment suppressed KRAS mutant tumour growth in mice, without having a detrimental effect on animal weight. Our study suggests that most KRAS oncoproteins cycle between an active state and an inactive state in cancer cells and are dependent on nucleotide exchange for activation. Pan-KRAS inhibitors, such as the one described here, have broad therapeutic implications and merit clinical investigation in patients with KRAS-driven cancers.