Keto macros are calculated by fixing carbohydrate first and letting fat be the remainder — the reverse of every other style. In MacroDiet the carbohydrate ceiling is 30 g (KETO_CARB_CEILING_G), protein is set from body weight exactly as usual, and fat takes every calorie that is left: fat = (calories − protein × 4 − 30 × 4) ÷ 9.
This article is about the arithmetic of that branch of the algorithm — the ceiling, why the order flips, and a worked example. It describes what the formula sets; it makes no claims about the diet itself.
The carb ceiling
On the balanced, low-fat and low-carb styles carbohydrate is the last macro computed and absorbs whatever changes. Keto cannot work that way, because the point of the style is a hard limit on carbohydrate. So the algorithm replaces the remainder rule with a constant: 30 g per day, 120 kcal.
Three things about the number. It is a ceiling, an upper limit the target sits at, not an amount to be reached. It is stricter than the 50–60 g figure used in much keto writing — the research lead behind this article quotes that band as the range keto intakes "rarely exceed" — and the app chose the tighter value so that the target is inside the band rather than at its edge. And it includes fibre: the target is total carbohydrate, so fibre grams count toward the 30.
| Definition of "keto carbs" | Grams per day | Where it comes from |
|---|---|---|
| MacroDiet ceiling | 30 g total carbohydrate | KETO_CARB_CEILING_G in the algorithm |
| Common keto guidance | 50–60 g | research lead (MacroFactor help corpus) |
| Low-carb (not keto) | < 200 g or about 30% of energy | working definition, same lead |
In plain terms: on keto the carb number is a constant, and it is the first thing the formula writes down.
Protein first, fat fills the rest
Protein is unchanged by the style. It is body weight × tier (1.2 / 1.6 / 2.0 / 2.4 g/kg), plus 0.2 g/kg on a losing goal, capped at 50% of calories — the same rule as every other split. Keto does not lower it, and a common mistake in other calculators — scaling protein down to make room for fat — does not happen here.
Once protein and the carb ceiling are fixed, fat is arithmetic:
fat grams = (calorie target − protein × 4 − 30 × 4) ÷ 9
If protein and carbohydrate together ever exceeded the calorie target, fat would be clamped at zero and the calculator would warn — that only occurs at very low targets with the extra-high protein tier.
Why keto flips the balancing macro
The "balancing macro" is whichever one absorbs a change in calories. On the other three styles that is carbohydrate: raise the target by 200 kcal and most of it becomes carbohydrate (fat takes its style share of the increase too). On keto, carbohydrate cannot move, so fat takes the whole change: 200 kcal is 22 g of fat, every time.
Two consequences follow.
The fat floor (max(0.6 g/kg, 20% of calories)) never applies on keto. Fat is already the remainder, and at any realistic calorie target it sits far above the floor — typically 65–75% of energy.
Weekly adjustments land on fat. When the calorie target moves after a check-in, a balanced-style user sees their carbohydrate target change; a keto user sees their fat target change, and their carbohydrate stays at 30 g.
Worked example
A 70 kg person, maintenance target 1,800 kcal, moderate protein tier, keto style — reproducible on the macro calculator:
| Step | Arithmetic | Result | Share of energy |
|---|---|---|---|
| Carbohydrate (ceiling) | fixed | 30 g = 120 kcal | 6.7% |
| Protein | 70 × 1.6 | 112 g = 448 kcal | 24.9% |
| Fat (remainder) | (1,800 − 448 − 120) ÷ 9 | 137 g = 1,233 kcal | 68.5% |
The same person on the balanced style at the same calories would be set 112 g protein, 53 g fat and 219 g carbohydrate. Protein is identical; the other two have swapped roles.
Switch the goal to lose at a moderate rate and the target drops by 385 kcal (0.5% of 70 kg is 0.35 kg/week, × 7,700 ÷ 7) to 1,415 kcal; protein rises to 70 × 1.8 = 126 g, carbohydrate stays at 30 g, and fat becomes (1,415 − 504 − 120) ÷ 9 = 88 g. Every calorie of the cut, plus the extra protein, came out of fat.
In plain terms: on keto the carb number is fixed, the protein number is the usual one, and fat is whatever is left.
The short version
Keto macros in MacroDiet: carbohydrate fixed at a 30 g ceiling (fibre included), protein from body weight as on every style, fat as the remainder divided by 9. The balancing role moves from carbohydrate to fat, so calorie changes and deficits show up in the fat target while carbs stay put. Macro splits compared puts keto beside the other three styles at the same calories.
Educational overview only — not medical advice. Zyra is a training and nutrition tracking tool; the numbers here are the algorithm's rules and published reference values, not an individual prescription.