ForHosting KIT · Developer Utilities

Macro Split from Calories Calculator

This macro split from calories calculator turns a daily energy target into practical gram targets for protein, carbohydrate, and fat.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter calories and any three-part positive ratio, such as 30:40:30 or 3:4:3, and the calculator normalizes the shares before applying the standard energy values of four calories per gram for protein, four for carbohydrate, and nine for fat. The calculation is fully offline, deterministic, and intended for planning rather than medical diagnosis or individualized nutrition treatment.

Choose a calorie target and a useful ratio

Start with the daily calorie target you have already selected, then provide positive weights for protein, carbohydrate, and fat. The values do not have to be percentages and do not have to add to 100. A ratio of 30:40:30 produces the same split as 3:4:3 because the calculator divides every weight by their combined total. This makes it easy to use ratios copied from a meal plan without manually converting them. All four inputs must be finite numbers greater than zero. Zero, negative values, missing fields, numeric strings, infinity, and nonnumeric values are rejected instead of being silently guessed. That strict behavior helps automated workflows catch malformed data early. Calorie targets and macro ratios are planning assumptions, not universal recommendations. Training volume, health conditions, medications, pregnancy, allergies, and clinical goals may change what is appropriate, so obtain qualified guidance when those factors matter. The tool only performs the requested arithmetic; it does not decide which calorie target or ratio is right for a particular person.

Understand how calories become grams

The calculator first normalizes each ratio weight into a percentage of the total. It then allocates the daily calorie target across those normalized shares. Protein and carbohydrate are converted at four calories per gram, while fat is converted at nine calories per gram. For example, a protein allocation of 600 calories becomes 150 grams. Results include the normalized percentage, calorie allocation, and gram target for every macro, with displayed numbers rounded to two decimal places. Computation uses the unrounded intermediate values, so early display rounding does not distort the gram totals. Because decimal gram values are often inconvenient in everyday meal planning, you may round them to whole grams afterward, understanding that the reconstructed calorie total can differ slightly. Food labels also use regulatory rounding and individual foods contain fiber, alcohol, or other components, so a logged menu may not reproduce the theoretical total exactly. The result is best treated as a consistent planning baseline rather than a laboratory measurement of food energy.

Use the result in a repeatable workflow

Apply the returned gram targets to a meal template, grocery plan, nutrition tracker, or coaching worksheet. If you divide targets across meals, distribute them in whatever pattern supports adherence; the calculator does not require equal meals or prescribe meal timing. When comparing alternative ratios, keep calories fixed and change only the three weights so the effect is easy to understand. Save the original inputs with the output because a gram target without its calorie target and ratio lacks useful context. The same input always returns the same result: there is no network call, randomness, stored profile, or date-dependent logic. That makes the capability suitable for spreadsheets, tests, scheduled planning pipelines, and applications that need reproducible output. Invalid or non-positive inputs return an explicit input error, allowing a caller to request corrections before using the numbers. Recalculate whenever the underlying target changes rather than scaling rounded grams manually. For health-related decisions, especially aggressive weight changes or disease management, review the plan with a registered dietitian or other qualified clinician.

Build a daily meal template

Turn an established calorie target and preferred macro ratio into gram goals that can be divided among meals.

Compare ratio scenarios

Hold calories constant while comparing how different positive macro weights change protein, carbohydrate, and fat grams.

Automate planning worksheets

Produce deterministic macro targets for a nutrition spreadsheet, coaching form, or application without a network dependency.

Must the ratio add to 100?

No. Any three positive weights are normalized by their total, so 3:4:3 and 30:40:30 are equivalent.

How are macro grams calculated?

Allocated protein and carbohydrate calories are divided by four, and allocated fat calories are divided by nine.

Why might food tracker calories differ?

Food labels and trackers may round values or account for components such as fiber and alcohol differently from the theoretical macro conversion.

Does this calculator recommend a diet?

No. It converts the target and ratio you provide; it does not determine whether either choice is medically or nutritionally appropriate.

What does the API calculation cost?

Each API request costs $0.002. The calculation itself is fully offline and deterministic.

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/macro-split-from-cal

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/macro-split-from-cal \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"calories":2000,"protein_ratio":30,"carbohydrate_ratio":40,"fat_ratio":30}'
{
  "calories": 2000,
  "protein_ratio": 30,
  "carbohydrate_ratio": 40,
  "fat_ratio": 30
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "health.macro_split_from_cal",
  "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.

Read the full KIT documentation →