# 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.

- Calculator id: `macros` · Category: Health (`health`) · Tool name: `calculate_macros`
- Canonical page: https://tttkmbb.com/health/macros · This document: https://tttkmbb.com/health/macros.md · JSON definition: https://tttkmbb.com/health/macros.json

## Purpose

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.

**Use when:** 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.

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `calories_per_day` | number | kcal/day | required | Daily calorie target. (min 500, max 10000) |
| `preset` | enum: balanced \| low_carb \| high_protein \| keto \| custom |  | optional, default "balanced" | Macronutrient ratio preset. Choose custom to supply your own percentages. |
| `protein_percent` | number | % | optional | Only for preset=custom. (min 0, max 100) |
| `carbs_percent` | number | % | optional | Only for preset=custom. (min 0, max 100) |
| `fat_percent` | number | % | optional | Only for preset=custom. (min 0, max 100) |

## Output

| Field | 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. |

## Formula

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

## Data Sources

- USDA Dietary Guidelines for Americans 2020–2025 – Acceptable Macronutrient Distribution Ranges — https://www.dietaryguidelines.gov/ (standard, retrieved 2026-09-23)
- Atwater general factors (FAO Food energy – methods of analysis and conversion factors) — https://www.fao.org/4/y5022e/y5022e00.htm (standard, retrieved 2026-09-23)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/macros?calories_per_day=…`
- `POST https://tttkmbb.com/api/v1/calculate/macros` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/macros · OpenAPI operationId `calculate_macros` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "macros", "inputs": {…}}`

## Example

- 2000 kcal balanced: inputs `{"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: inputs `{"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
```

## Limitations

Medical diets (renal, diabetic, PKU) are involved; those need individualised prescriptions. All values are computed from the formula above; no measurement or live data is involved.

## 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

- [TDEE Calculator](https://tttkmbb.com/health/tdee.md) — Get the calorie target first.
- [Protein Intake Calculator](https://tttkmbb.com/health/protein-intake.md) — Check protein against body-weight based recommendations.
