We summarize the main ideas used to determine the thermodynamic properties of pure systems and binary alloys from first principles calculations. These are based on the ab initio calculations of free energies. As an application we present the study of iron and iron alloys under Earth’s core conditions. In particular, we report the whole melting curve of iron under these conditions, and we put constraints on the composition of the core. We found that iron melts at 6350±600 K at the pressure corresponding to the boundary between the solid inner core and the liquid outer core (ICB). We show that the core could not have been formed from a binary mixture of Fe with S, Si or O and we propose a ternary or quaternary mixture with 8–10% of S/Si in both liquid and solid and an additional ~8% of oxygen in the liquid. Based on this proposed composition we calculate the shift of melting temperature with respect to the melting temperature of pure Fe of ~–700 K, so that our best estimate for the temperature of the Earth’s core at ICB is 5650±600 K.