ForHosting KIT · Health & fitness

Calories from macronutrients calculator (Atwater)

Turns grams of protein, carbohydrate, fat and alcohol into calories with the Atwater factors: 25 g protein, 40 g carbs and 12 g fat add up to 368 kcal. You also see each macro's share and the total in kilojoules. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Protein g
25
Carbohydrate g
40
Fat g
12
Alcohol g
0
You get
Protein kcal
100 kcal
Carbohydrate kcal
160
Fat kcal
108
Alcohol kcal
0

Food labels, meal logs, and nutrition pipelines all need a transparent answer to one question: given the grams of protein, carbohydrate, fat, and alcohol in a serving or a day, how much metabolizable energy does that supply? This calories from macronutrients calculator applies the general Atwater factors—four kilocalories per gram for protein, four for carbohydrate, nine for fat, and seven for alcohol—and returns both the contribution of each macronutrient and the total energy in kilocalories and kilojoules. Use it to verify label math, convert tracker exports into energy totals, or audit meal plans without shipping a spreadsheet formula into every client.

Atwater factors and what total food energy means

The general Atwater system is the conventional way nutrition science and food labeling convert macronutrient mass into metabolizable energy. Protein and available carbohydrate are each assigned four kilocalories per gram, fat nine kilocalories per gram, and ethanol seven kilocalories per gram. Those factors already average digestive losses and the heat of combustion adjustments used in dietetics; they are not the raw bomb-calorimeter values for every food, but the standard default when only grams are known.

Total energy is the sum of the four products: four times protein grams plus four times carbohydrate grams plus nine times fat grams plus seven times alcohol grams. This capability does not adjust for dietary fibre fractions, sugar alcohols with alternate factors, or incomplete protein digestibility—those refinements need food-composition tables and are outside a pure grams-to-energy transform. What you get is a reproducible label-style total that matches how most consumer apps and many regulatory examples teach calories from macros.

Who rechecks calories from macros, and why

Diet coaching platforms already store gram targets and plate logs; multiplying by Atwater factors server-side keeps every client and report on one definition of food energy instead of diverging spreadsheet cells. Research coordinators convert weighed-food diaries into daily energy without embedding nutrition database licenses when only macros were recorded. Label compliance tools recompute the energy line from declared protein, carbohydrate, fat, and alcohol so a packaging change can be rechecked in seconds.

Meal-kit and cafeteria engineering teams batch-sum component macros into dish energy for menus and procurement. Failed validation does not consume balance.

Verify food-label energy from declared macros

Recompute the calories line from protein, carbohydrate, fat, and alcohol grams using standard Atwater factors before packaging or menu publish.

Which Atwater factors does this calculator use?

General factors: 4 kcal/g protein, 4 kcal/g carbohydrate, 9 kcal/g fat, and 7 kcal/g alcohol. The response includes a factors object so you can display the table next to the total.

Is alcohol required if the food has none?

All four gram fields are required so missing input is never treated as zero by accident.

Why doesn't the total match the calories on my food label?

Because the calculator applies the general Atwater factors. It does not adjust for fibre fractions, sugar alcohols with their own factors or incomplete protein digestibility; those refinements need food-composition tables.

Which macronutrient adds the most calories to my meal?

The calculator shows each contribution separately. With 25 g protein, 40 g carbohydrate and 12 g fat you get 100, 160 and 108 kcal: at 9 kcal per gram, fat nearly matches carbohydrate with less than a third of the grams.

How do I convert the total from kilocalories to kilojoules?

No need to do it by hand: the result shows both. Kilojoules are kilocalories multiplied by 4.184, so 368 kcal equals 1539.712 kJ.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/health/energy-from-macros

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/health/energy-from-macros \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"protein_g":25,"carbohydrate_g":40,"fat_g":12,"alcohol_g":0}'
{
  "protein_g": 25,
  "carbohydrate_g": 40,
  "fat_g": 12,
  "alcohol_g": 0
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "health.energy_from_macros",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Input contract, response fields, and validation errors

Negative grams are rejected because mass cannot be negative in this contract. Missing any of the four fields also fails with a clear missing-field message and is not billed. Example: twenty-five grams protein, forty grams carbohydrate, twelve grams fat, and zero alcohol yields one hundred protein kcal, one hundred sixty carbohydrate kcal, one hundred eight fat kcal, zero alcohol kcal, and three hundred sixty-eight total kilocalories. POST a JSON object with four required finite non-negative numbers: protein_g, carbohydrate_g, fat_g, and alcohol_g, each measured in grams. Short aliases are accepted so existing forms can wire without renaming: protein, protein_grams, or p for protein; carbohydrate, carbs, carb_g, carbs_g, or c for carbohydrate; fat, lipid_g, lipids, or f for fat; alcohol, ethanol_g, ethanol, or a for alcohol. Values may arrive as JSON numbers or numeric strings; empty strings, booleans, objects, NaN, and Infinity all fail with invalid_input naming the field. On success the response echoes the cleaned gram inputs, returns protein_kcal, carbohydrate_kcal, fat_kcal, and alcohol_kcal as the per-macro contributions, total_kcal as their sum, total_kj as total_kcal times four point one eight four (thermochemical conversion), a factors object restating four, four, nine, and seven, a short formula string, and unit set to kcal for the primary energy figure. Pair the free browser check with API automation when you need the same numbers in a backend log.

Convert meal-tracker grams into daily energy

Sum logged macro grams for a day or serving and obtain total_kcal and total_kj with a deterministic API contract for reports and dashboards.

Audit coaching plans and research diaries

Apply one shared 4/4/9/7 definition across client plans or study food records so energy totals stay comparable and golden-testable.

How do I compute calories from macronutrient grams?

Send non-negative finite protein_g, carbohydrate_g, fat_g, and alcohol_g. total_kcal equals 4·P + 4·C + 9·F + 7·A; total_kj equals total_kcal × 4.184.

Why was my request rejected?

Each field must be a finite non-negative number (JSON number or numeric string). Missing, non-numeric, infinite, or negative values return invalid_input and are not billed.

What does the calories from macronutrients calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →