Heat capacity of matter is considered to be its most important property because it holds information about system's degrees of freedom as well as the regime in which the system operates, classical or quantum. Heat capacity is well understood in gases and solids but not in the third main state of matter, liquids, and is not discussed in physics textbooks as a result. The perceived difficulty is that interactions in a liquid are both strong and system-specific, implying that the energy strongly depends on the liquid type and that, therefore, liquid energy can not be calculated in general form. Here, we develop a phonon theory of liquids where this problem is avoided. The theory covers both classical and quantum regimes. We demonstrate good agreement of calculated and experimental heat capacity of 21 liquids, including noble, metallic, molecular and hydrogen-bonded network liquids in a wide range of temperature and pressure.