The presence of light elements in the metallic cores of the Earth, the Moon, and other rocky planetary bodies has been widely proposed. Carbon is among the top candidates in light of its high cosmic abundance, siderophile nature, and ubiquity in iron meteorites. It is, however, still controversial whether carbon-rich core compositional models can account for the seismic velocity observations within the Earth and lunar cores. Here, we report the density and elasticity of Fe90Ni10-3 wt.% C and Fe90Ni10-5 wt.% C liquid alloys using synchrotron-based X-ray absorption experiments and first-principles molecular dynamics simulations. Our results show that alloying of 3 wt.% and 5 wt.% C lowers the density of Fe90Ni10 liquid by similar to 2.9-3.1% at 2 GPa, and similar to 3.4-3.6% at 9 GPa. More intriguingly, our experiments and simulations both demonstrate that the bulk moduli of the Fe-Ni-C liquids are similar to or slightly higher than those of Fe-Ni liquids. Thus, the calculated compressional velocities (v(p)) of Fe-Ni-C liquids are higher than that of pure Fe-Ni alloy, promoting carbon as a possible candidate to explain the elevated v(p) in the Earth's outer core. However, the values and slopes of both density and v(p) of the studied two Fe-Ni-C liquids do not match the outer core seismic models, suggesting that carbon may not be the sole principal light element in Earth's outer core. The high v(p) of Fe-Ni-C liquids does not match the presumptive v(p) of the lunar outer core well, indicating that carbon is less likely to be its dominant light element.