HomeHealth › Macro Calculator

Macro Calculator

Splits a daily calorie target into grams of protein, carbohydrate and fat using a preset ratio (balanced, low-carb, high-protein, keto) or custom percentages.

When to use

You have a calorie target (from tdee) and want gram targets for each macronutrient.

Do not use when: Medical diets (renal, diabetic, PKU) are involved; those need individualised prescriptions.

Formula

grams = calories × percent / (4 kcal/g for protein and carbohydrate, 9 kcal/g for fat)

Inputs

ParameterTypeUnitRequiredDescription
calories_per_daynumberkcal/dayyesDaily calorie target. Range: ≥ 500, ≤ 10000
presetenum: balanced | low_carb | high_protein | keto | customdefault balancedMacronutrient ratio preset. Choose custom to supply your own percentages.
protein_percentnumber%noOnly for preset=custom. Range: ≥ 0, ≤ 100
carbs_percentnumber%noOnly for preset=custom. Range: ≥ 0, ≤ 100
fat_percentnumber%noOnly for preset=custom. Range: ≥ 0, ≤ 100

Outputs

OutputTypeUnitDescription
protein_gnumberg/dayProtein grams (4 kcal/g).
carbs_gnumberg/dayCarbohydrate grams (4 kcal/g).
fat_gnumberg/dayFat grams (9 kcal/g).
ratiostringProtein/carbs/fat percentages applied.

Example

2000 kcal balanced: {"calories_per_day":2000,"preset":"balanced"}{"protein_g":150,"carbs_g":200,"fat_g":67,"ratio":"30/40/30"}

2200 kcal custom 35/35/30: {"calories_per_day":2200,"preset":"custom","protein_percent":35,"carbs_percent":35,"fat_percent":30}{"protein_g":193,"carbs_g":193,"fat_g":73}

GET https://tttkmbb.com/api/v1/calculate/macros?calories_per_day=2000&preset=balanced

Machine access

Sources

FAQ

Which preset should I use?

Balanced suits most people; high-protein helps preserve muscle in a deficit; keto requires carbs below ~50 g/day and is not suitable for everyone.

Do the percentages have to sum to 100?

Yes for custom ratios; the calculator returns an error otherwise.

Related calculators