HomeFood & Cooking › Calories from Macros Calculator

Calories from Macros Calculator

Converts grams of protein, carbohydrate, fat and alcohol into kilocalories and kilojoules with the Atwater general factors (4 / 4 / 9 / 7 kcal per gram) and reports each macronutrient's share of total energy.

When to use

You have the macronutrient grams of a food, meal or daily intake and need total calories or the percentage split, e.g. to check a food label or diet plan.

Do not use when: You want to go the other way, from a calorie target to gram targets (use macros), or need calorie needs (use tdee).

Formula

kcal = 4·protein_g + 4·(carbs_g − fiber_g) + 2·fiber_g + 9·fat_g + 7·alcohol_g; percent_x = kcal_x / kcal × 100; kJ = kcal × 4.184

Atwater general factors are averages of metabolisable energy; label values can differ by a few percent because manufacturers may use specific factors, and US labels may count insoluble fibre at 0 kcal/g.

Inputs

ParameterTypeUnitRequiredDescription
protein_gnumbergyesProtein in grams. Range: ≥ 0, ≤ 5000
carbs_gnumbergyesTotal carbohydrate in grams, including any fibre. Range: ≥ 0, ≤ 5000
fat_gnumbergyesFat in grams. Range: ≥ 0, ≤ 5000
alcohol_gnumbergdefault 0Ethanol in grams (a 330 ml 5 % beer contains about 13 g). Range: ≥ 0, ≤ 1000
fiber_gnumbergnoOptional fibre included in carbs_g; counted at 2 kcal/g (EU labelling factor) instead of 4 kcal/g. Range: ≥ 0, ≤ 1000

Outputs

OutputTypeUnitDescription
calories_kcalnumberkcalSum of all macronutrient energy.
energy_kjnumberkJTotal energy in kilojoules (× 4.184).
protein_kcalnumberkcalprotein_g × 4.
carbs_kcalnumberkcal(carbs_g − fiber_g) × 4 + fiber_g × 2.
fat_kcalnumberkcalfat_g × 9.
alcohol_kcalnumberkcalalcohol_g × 7.
protein_percentnumber%Protein energy as a percentage of total energy.
carbs_percentnumber%Carbohydrate energy as a percentage of total energy.
fat_percentnumber%Fat energy as a percentage of total energy.
alcohol_percentnumber%Alcohol energy as a percentage of total energy.

Example

30 g protein, 40 g carbs, 10 g fat: {"protein_g":30,"carbs_g":40,"fat_g":10}{"calories_kcal":370,"energy_kj":1548,"protein_kcal":120,"carbs_kcal":160,"fat_kcal":90,"protein_percent":32.4,"carbs_percent":43.2,"fat_percent":24.3,"alcohol_percent":0}

25 / 50 / 15 g plus 14 g alcohol: {"protein_g":25,"carbs_g":50,"fat_g":15,"alcohol_g":14}{"calories_kcal":533,"alcohol_kcal":98,"alcohol_percent":18.4,"carbs_percent":37.5}

GET https://tttkmbb.com/api/v1/calculate/calories-from-macros?protein_g=30&carbs_g=40&fat_g=10

Machine access

Sources

FAQ

Why does the label show fewer calories than this?

Labels may subtract insoluble fibre entirely (US) or use specific Atwater factors for the food; rounding rules also allow small differences.

Does 'net carbs' apply here?

Only via fiber_g: fibre is counted at 2 kcal/g. Sugar alcohols are not handled separately (they average about 2.4 kcal/g).

Related calculators