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
- Enter daily calories (kcal) (between 0 and 20000).
- Enter carbohydrate (%) (between 0 and 100). It starts at 40.
- Enter protein (%) (between 0 and 100). It starts at 30.
- Enter fat (%) (between 0 and 100). It starts at 30.
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| Daily calories | A number, in kcal | > 0, ≤ 20000 |
| Carbohydrate | A number, in % | ≥ 0, ≤ 100, starts at 40 |
| Protein | A number, in % | ≥ 0, ≤ 100, starts at 30 |
| Fat | A 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.
| Result | Value |
|---|---|
| Carbohydrate | 200 g carbohydrate |
| Protein | 150 g |
| Fat | 66.7 g |
Example 2
Inputs: Daily calories = 1800; Carbohydrate = 50; Protein = 20; Fat = 30.
| Result | Value |
|---|---|
| Carbohydrate | 225 g carbohydrate |
| Protein | 90 g |
| Fat | 60 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.
| Calories | Carbohydrate | Protein | Fat |
|---|---|---|---|
| 1600 | 160 g carbohydrate | 120 g | 53.3 g |
| 2000 | 200 g carbohydrate | 150 g | 66.7 g |
| 2400 | 240 g carbohydrate | 180 g | 80 g |
| 3000 | 300 g carbohydrate | 225 g | 100 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.
| Calculator | You enter | It returns |
|---|---|---|
| [Calorie Calculator](/health/calorie-calculator/) | units, sex and weight | Maintenance calories |
| [Calorie Deficit Calculator](/health/calorie-deficit-calculator/) | units, weight to lose and time | Daily calorie deficit |
| [TDEE Calculator](/health/tdee-calculator/) | units, sex and weight | Total daily energy expenditure |
| [BMR Calculator](/health/bmr-calculator/) | units, sex and weight | Basal metabolic rate |
| [Keto Macro Calculator](/health/keto-calculator/) | daily calories, body weight and protein per kg of body weight | Fat |
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%.
Related calculators
- Calorie Calculator — Daily calories to maintain, lose or gain weight.
- TDEE Calculator — Total daily energy expenditure from BMR and activity level.
- BMR Calculator — Estimate basal metabolic rate with the Mifflin–St Jeor and revised Harris–Benedict equations.
- Protein Calculator — Daily protein target by body weight and activity.
- Calories Burned Calculator — Estimate calories burned from activity, body weight and time using MET values.
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.