Since Ross proposed that there might be `diamonds in the sky' in 1981 (ref. 1), the idea of significant quantities of pure carbon existing in giant planets such as Uranus and Neptune has gained both experimental and theoretical support. It is now accepted that the high-pressure, high-temperature behaviour of carbon is essential to predicting the evolution and structure of such planets. Still, one of the most defining of thermal properties for diamond, the melting temperature, has never been directly measured. This is perhaps understandable, given that diamond is thermodynamically unstable, converting to graphite before melting at ambient pressure, and tightly bonded, being the strongest bulk material known. Shock-compression experiments on diamond reported here reveal the melting temperature of carbon at pressures of 0.6-1.1TPa (6-11Mbar), and show that crystalline diamond can be stable deep inside giant planets such as Uranus and Neptune. The data indicate that diamond melts to a denser, metallic fluid-with the melting curve showing a negative Clapeyron slope-between 0.60 and 1.05TPa, in good agreement with predictions of first-principles calculations. Temperature data at still higher pressures suggest diamond melts to a complex fluid state, which dissociates at shock pressures between 1.1 and 2.5TPa (11-25Mbar) as the temperatures increase above 50,000K.