Skip to content
CalculatorAtlas

Macro Calculator

Tested

Split daily calories into grams of carbohydrate, protein and fat.

Tested, not yet published. The formula for this calculator is implemented and passes its automated checks. This page stays non-indexable until it is reviewed and published.

kcal
%
%
%

Results

Enter your values and press Calculate. Results appear here.

  • • Result

Quick answer

Macros are the grams of carbohydrate, protein and fat that fit a calorie target and a percentage split. Multiply the calories by each share and divide by the energy per gram (4 for carbohydrate and protein, 9 for fat): 2,400 kcal at 40% carbohydrate, 30% protein and 30% fat is 240 g carbohydrate, 180 g protein and 80 g fat.

The three shares must total 100%. If you do not know your calorie target, estimate it first with the TDEE calculator; to set protein from body weight and fat by calories instead, use the keto macro calculator, which works that way.

Related tools: Calorie Calculator: Daily calories to maintain, lose or gain weight. TDEE Calculator: Total daily energy expenditure from BMR and activity level.

How to use the Macro Calculator

  1. Enter daily calories (kcal) (between 0 and 20000).
  2. Enter carbohydrate (%) (between 0 and 100). It starts at 40.
  3. Enter protein (%) (between 0 and 100). It starts at 30.
  4. Enter fat (%) (between 0 and 100). It starts at 30.
  5. Press Calculate to see the result, and use Reset to start again.
Inputs of the Macro Calculator
InputWhat to enterAllowed values
Daily caloriesA number, in kcal> 0, ≤ 20000
CarbohydrateA number, in %≥ 0, ≤ 100, starts at 40
ProteinA number, in %≥ 0, ≤ 100, starts at 30
FatA number, in %≥ 0, ≤ 100, starts at 30

Formula and method

Formula

grams = calories × share ÷ energy density (carbohydrate 4, protein 4, fat 9 kcal/g)

IEEE-754 double precision; shown to 1 decimal place unless stated.

Atwater general factors; the three shares must total 100%. Informational estimate, not medical advice. Talk to a qualified health professional about your own situation.

Worked examples

These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.

Example 1

Inputs: Daily calories = 2000; Carbohydrate = 40; Protein = 30; Fat = 30.

Results of example 1
ResultValue
Carbohydrate200 g carbohydrate
Protein150 g
Fat66.7 g

Example 2

Inputs: Daily calories = 1800; Carbohydrate = 50; Protein = 20; Fat = 30.

Results of example 2
ResultValue
Carbohydrate225 g carbohydrate
Protein90 g
Fat60 g

The first line is the headline result (carbohydrate). Below it the macro Calculator lists protein and fat, which describe the same case from other angles. IEEE-754 double precision; shown to 1 decimal place unless stated.

Why 4, 4 and 9

These are the Atwater general energy factors used on nutrition labels: protein and carbohydrate give about 4 kilocalories per gram and fat about 9. Because fat is so energy-dense, 30% of calories from fat is far fewer grams than 30% from protein. This is a planning tool, not a diet prescription, and nobody's needs are identical.

A 40/30/30 split at different calorie levels

Every figure in this table comes from running this calculator, so it matches what the form returns.

A 40/30/30 split at different calorie levels
CaloriesCarbohydrateProteinFat
1600160 g carbohydrate120 g53.3 g
2000200 g carbohydrate150 g66.7 g
2400240 g carbohydrate180 g80 g
3000300 g carbohydrate225 g100 g

What happens with invalid input

These messages are produced by the calculator itself, so you know what to fix.

  • Fat: entering "20" shows "Carbohydrate, protein and fat must add up to 100%." beside that field and no result.

Choosing between the Macro Calculator and similar calculators

Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.

Choosing between the Macro Calculator and similar calculators
CalculatorYou enterIt returns
[Calorie Calculator](/health/calorie-calculator/)units, sex and weightMaintenance calories
[Calorie Deficit Calculator](/health/calorie-deficit-calculator/)units, weight to lose and timeDaily calorie deficit
[TDEE Calculator](/health/tdee-calculator/)units, sex and weightTotal daily energy expenditure
[BMR Calculator](/health/bmr-calculator/)units, sex and weightBasal metabolic rate
[Keto Macro Calculator](/health/keto-calculator/)daily calories, body weight and protein per kg of body weightFat

Background: nutrition estimates

Nutrition calculators estimate: they use population-average equations and food tables, and different tables give different numbers for the same food. Certain medical conditions change energy needs in ways basic formulas cannot see, and only laboratory analysis gives exact nutrient values.

Use the result as a starting point, track what actually happens over a few weeks and adjust; ask a qualified professional about medical or clinical decisions.

Assumptions and limitations

  • Shares must total 100%
  • Not a diagnosis

This calculator gives general information based on published formulas. It is not medical advice, and it cannot account for your health history. Talk to a qualified clinician about decisions that affect your health.

If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for fat to confirm this.

Frequently asked questions

Why must the percentages add up to 100?

Because every calorie has to belong to one of the three macronutrients. The calculator shows an error when the shares do not total 100%.

What does the Macro Calculator calculate?

Split daily calories into grams of carbohydrate, protein and fat. It returns Carbohydrate, Protein and Fat.

What formula does the Macro Calculator use?

grams = calories × share ÷ energy density (carbohydrate 4, protein 4, fat 9 kcal/g). Atwater general factors; the three shares must total 100%.

What do I need to enter in the macro Calculator?

You enter Daily calories (kcal), Carbohydrate (%), Protein (%) and Fat (%).

How is the result rounded or limited?

IEEE-754 double precision; shown to 1 decimal place unless stated. Shares must total 100%.

What are the limits of this calculator?

Shares must total 100%. Not a diagnosis.

What is an example of a macro result?

With daily calories 2000, carbohydrate 40, protein 30 and fat 30, the carbohydrate is 200 g carbohydrate.

Where does the method come from?

The method follows: FAO Food and Nutrition Paper 77: Food energy – methods of analysis and conversion factors (2003).

Can I rely on this calculator for a decision?

This calculator gives general information based on published formulas. It is not medical advice, and it cannot account for your health history. Talk to a qualified clinician about decisions that affect your health. For this calculator in particular: Shares must total 100%.

Sources

  • FAO Food and Nutrition Paper 77: Food energy – methods of analysis and conversion factors (2003)

Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.