Earth's inner core is known to consist of crystalline iron alloyed with a small amount of nickel and lighter elements, but the shear wave (S wave) travels through the inner core at about half the speed expected for most iron-rich alloys under relevant pressures. The anomalously low S-wave velocity (vS) has been attributed to the presence of liquid, hence questioning the solidity of the inner core. Here we report new experimental data up to core pressures on iron carbide Fe7C3, a candidate component of the inner core, showing that its sound velocities dropped significantly near the end of a pressure-induced spin-pairing transition, which took place gradually between 10 GPa and 53 GPa. Following the transition, the sound velocities increased with density at an exceptionally low rate. Extrapolating the data to the inner core pressure and accounting for the temperature effect, we found that low-spin Fe7C3 can reproduce the observed vS of the inner core, thus eliminating the need to invoke partial melting or a postulated large temperature effect. The model of a carbon-rich inner core may be consistent with existing constraints on the Earth's carbon budget and would imply that as much as two thirds of the planet's carbon is hidden in its center sphere. iron carbide, shear wave velocity.