The Eckstrom-Adcock iron carbide, nominally Fe7C3, is a potential host of reduced carbon in Earth's mantle and a candidate component of the inner core. Non-stoichiometry in Fe7C3 has been observed previously, but the crystal chemistry basis for its origin and influences on the physical properties were not known. Here we report chemical and structural analyses of synthetic Fe7C3 that was grown through a diffusive reaction between iron and graphite and contained 31 to 35 at% carbon. We found that more carbon-rich Fe7C3 has smaller unit-cell volume, suggesting that excess carbon atoms substituted for iron atoms instead of entering the interstitial sites of closed-packed iron lattice as in FeCx steel. Carbon may be the lightest alloying element to substitute for iron. The substitution leads to a larger reduction in the unit-cell mass than the volume so that the carbon-rich end-member may be as much as 5% less dense than stoichiometric Fe7C3. If Fe7C3 solidifies from Earth's iron-rich liquid core, it is expected to have a nearly stoichiometric composition with a compositional expansion coefficient of ~1.0. However, laboratory experiments using carbon-rich synthetic Fe7C3 to model the inner core may overestimate the amount of carbon that is needed to account for the core density deficit.