Understanding the effect of carbon on the density of hcp (hexagonal-close-packed) Fe-C alloys is essential for modeling the carbon content in the Earth’s inner core. Previous studies have focused on the equations of state of iron carbides that may not be applicable to the solid inner core that may incorporate carbon as dissolved carbon in metallic iron. Carbon substitution in hcp-Fe and its effect on the density have never been experimentally studied. We investigated the compression behavior of Fe-C alloys with 0.31 and 1.37 wt % carbon, along with pure iron as a reference, by in-situ X-ray diffraction measurements up to 135 GPa for pure Fe, and 87 GPa for Fe-0.31C and 109 GPa for Fe-1.37C. The results show that the incorporation of carbon in hcp-Fe leads to the expansion of the lattice, contrary to the known effect in body-centered cubic (bcc)-Fe, suggesting a change in the substitution mechanism or local environment. The data on axial compressibility suggest that increasing carbon content could enhance seismic anisotropy in the Earth’s inner core. The new thermoelastic parameters allow us to develop a thermoelastic model to estimate the carbon content in the inner core when carbon is incorporated as dissolved carbon hcp-Fe. The required carbon contents to explain the density deficit of Earth’s inner core are 1.30 and 0.43 wt % at inner core boundary temperatures of 5000 K and 7000 K, respectively.