Home › Health › 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
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
calories_per_day | number | kcal/day | yes | Daily calorie target. Range: ≥ 500, ≤ 10000 |
preset | enum: balanced | low_carb | high_protein | keto | custom | default balanced | Macronutrient ratio preset. Choose custom to supply your own percentages. | |
protein_percent | number | % | no | Only for preset=custom. Range: ≥ 0, ≤ 100 |
carbs_percent | number | % | no | Only for preset=custom. Range: ≥ 0, ≤ 100 |
fat_percent | number | % | no | Only for preset=custom. Range: ≥ 0, ≤ 100 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
protein_g | number | g/day | Protein grams (4 kcal/g). |
carbs_g | number | g/day | Carbohydrate grams (4 kcal/g). |
fat_g | number | g/day | Fat grams (9 kcal/g). |
ratio | string | Protein/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
- API:
GET https://tttkmbb.com/api/v1/calculate/macros(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/macros · Markdown: https://tttkmbb.com/health/macros.md · JSON definition: https://tttkmbb.com/health/macros.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="macros" - OpenAPI operationId:
calculate_macros - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
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
- TDEE Calculator — Get the calorie target first.
- Protein Intake Calculator — Check protein against body-weight based recommendations.