Macro Nutrient Calculator Formula
Understand the math behind the macro nutrient calculator. Each variable explained with a worked example.
Formulas Used
Protein (grams)
protein_grams = calories * protein_pct / 100 / 4Carbs (grams)
carbs_grams = calories * carbs_pct / 100 / 4Fat (grams)
fat_grams = calories * fat_pct / 100 / 9Protein Calories
protein_cal = calories * protein_pct / 100Carbs Calories
carbs_cal = calories * carbs_pct / 100Fat Calories
fat_cal = calories * fat_pct / 100Variables
| Variable | Description | Default |
|---|---|---|
calories | Daily Calories(cal) | 2500 |
protein_pct | Protein %(%) | 30 |
carbs_pct | Carbs %(%) | 40 |
fat_pct | Fat %(%) | 30 |
How It Works
How Macros Are Calculated
Macronutrients provide calories at different rates:
Formula
Grams = (Total Calories x Macro %) / Calories per gram
Ensure your percentages add up to 100%.
Worked Example
2,500 calories with a 30/40/30 split (protein/carbs/fat).
calories = 2500protein_pct = 30carbs_pct = 40fat_pct = 30
- 01Protein: 2500 x 0.30 / 4 = 188g (750 cal)
- 02Carbs: 2500 x 0.40 / 4 = 250g (1000 cal)
- 03Fat: 2500 x 0.30 / 9 = 83g (750 cal)
Ready to run the numbers?
Open Macro Nutrient Calculator