Macro Calculator
Split a daily calorie target into protein, carb, and fat grams using a chosen macro ratio.
Choose a split:
How the gram conversion works
Multiply your calorie target by each macro's percentage to get that macro's calorie share, then divide by its calories-per-gram: 4 for protein and carbs, 9 for fat. Fat's higher energy density means the same percentage of calories translates into noticeably fewer grams than protein or carbs at the same percentage.
Worked example (2,000 calories, Balanced 30/40/30)
| Macro | Calories | Grams |
|---|---|---|
| Protein (30%) | 600 kcal | 150 g |
| Carbs (40%) | 800 kcal | 200 g |
| Fat (30%) | 600 kcal | 67 g |
How to calculate macros in Python
def macros_from_calories(calories, protein_pct, carbs_pct, fat_pct):
protein_g = calories * (protein_pct / 100) / 4
carbs_g = calories * (carbs_pct / 100) / 4
fat_g = calories * (fat_pct / 100) / 9
return round(protein_g), round(carbs_g), round(fat_g)
print(macros_from_calories(2000, 30, 40, 30)) # (150, 200, 67)
These splits are illustrative starting points, not medical advice. Anyone with a health condition or specific dietary need should get personalized guidance from a doctor or registered dietitian.