Highly expressed proteins can exhibit relatively small material costs, in terms of the quantities of carbon (C), nitrogen (N) or sulphur (S) atoms they contain. This 'elemental sparing' probably reflects selection to reduce the quantities of potentially growth-limiting elements in abundant proteins, but the evolutionary mechanisms for adaptive elemental sparing are still poorly understood. Here, we predict that the extent of 'elemental sparing' in highly expressed proteins will vary among organisms, according to the effectiveness of selection in determining the fate of mutations. We test this hypothesis in bacteria by asking whether 'elemental sparing' is correlated with codon usage bias. Bacteria exhibit extraordinary variation in their life histories and demography and consequently in the effectiveness of selection in determining whether preferred codons are used in highly expressed genes. We find that C sparing and S sparing, but not N sparing, are significantly correlated with adaptive codon usage bias among 148 genera of bacteria, suggesting that selection for elemental sparing and codon bias are promoted by similar bacterial traits. Our study helps identify principles that determine how nutrient scarcity can shape the elemental composition of proteins.