Home › Food & 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
protein_g | number | g | yes | Protein in grams. Range: ≥ 0, ≤ 5000 |
carbs_g | number | g | yes | Total carbohydrate in grams, including any fibre. Range: ≥ 0, ≤ 5000 |
fat_g | number | g | yes | Fat in grams. Range: ≥ 0, ≤ 5000 |
alcohol_g | number | g | default 0 | Ethanol in grams (a 330 ml 5 % beer contains about 13 g). Range: ≥ 0, ≤ 1000 |
fiber_g | number | g | no | Optional fibre included in carbs_g; counted at 2 kcal/g (EU labelling factor) instead of 4 kcal/g. Range: ≥ 0, ≤ 1000 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
calories_kcal | number | kcal | Sum of all macronutrient energy. |
energy_kj | number | kJ | Total energy in kilojoules (× 4.184). |
protein_kcal | number | kcal | protein_g × 4. |
carbs_kcal | number | kcal | (carbs_g − fiber_g) × 4 + fiber_g × 2. |
fat_kcal | number | kcal | fat_g × 9. |
alcohol_kcal | number | kcal | alcohol_g × 7. |
protein_percent | number | % | Protein energy as a percentage of total energy. |
carbs_percent | number | % | Carbohydrate energy as a percentage of total energy. |
fat_percent | number | % | Fat energy as a percentage of total energy. |
alcohol_percent | number | % | 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
- API:
GET https://tttkmbb.com/api/v1/calculate/calories-from-macros(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/calories-from-macros · Markdown: https://tttkmbb.com/food/calories-from-macros.md · JSON definition: https://tttkmbb.com/food/calories-from-macros.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="calories-from-macros" - OpenAPI operationId:
calculate_calories_from_macros - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
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
- Macro Calculator — Reverse direction: grams of each macro from a calorie target.
- TDEE Calculator — Compare the intake with daily energy needs.