One gram of carbohydrate or protein provides about 4 calories of food energy. More precisely, nutrition labels generally use 4 kilocalories (kcal) per gram, with “calorie” commonly meaning a kilocalorie in dietary contexts.
This value comes from the Atwater system, which estimates usable energy from the main macronutrients. Carbohydrates and proteins are assigned approximately 17 kilojoules per gram, equivalent to about 4 kcal. The figure is an average rather than a perfect measurement for every food.
Fat is more energy-dense, providing about 9 kcal per gram, while alcohol provides about 7 kcal per gram. Fiber and sugar alcohols may provide less energy because they are incompletely digested or absorbed.
A common mix-up is confusing a food Calorie with the small scientific calorie. One dietary Calorie, written with a capital C, equals 1 kilocalorie, or 1,000 small calories. Thus, a food containing 20 grams of carbohydrate contributes roughly 80 kcal from that carbohydrate.