In more detail
In physics a small calorie (cal) warms 1 g of water by 1 °C; the food Calorie is 1,000 of them, a kilocalorie (kcal). Many countries print both kcal and kilojoules on labels: 1 kcal = 4.184 kJ, so 2,000 kcal is 8,368 kJ. Food energy is estimated with the Atwater factors: 4 kcal per gram of protein or carbohydrate, 9 for fat and 7 for alcohol. Exercise energy is often estimated as MET × kg × hours: 5 METs for an hour at 70 kg burns 350 kcal.
Why it matters
Calorie figures are estimates. The Atwater factors are averages, labels are allowed some tolerance, and how much energy you actually absorb depends on the food and how it is prepared. The popular rule of 3,500 kcal per pound of fat is a rough starting point that overstates long-term weight change, because the body adapts as weight changes.
Example
A snack label lists 10 g protein, 30 g carbohydrate and 12 g fat:
10×4 + 30×4 + 12×9 = 40 + 120 + 108 = 268 kcal
268 × 4.184 = 1,121 kJ
Common confusion
The "calories" on a food label are kilocalories: 268 "calories" are 268,000 small calories. For how those kilocalories split between protein, carbohydrate and fat, see Macronutrients.