BMI, calories, and protein with error bounds
body_metricsCompute BMI, energy expenditure, and protein targets from height and weight, with explicit error bounds.
Use this for any of those calculations rather than doing the arithmetic. Two reasons, and the second is the important one:
UNITS. A bare number is ambiguous — "170" is a height in centimetres or a weight in pounds depending entirely on context, and a wrong unit yields a plausible BMI that is off by a factor of two. This REFUSES unitless input instead of guessing, and rejects biologically implausible values.
FALSE PRECISION. The standard equations disagree. Mifflin-St Jeor and Harris-Benedict routinely differ by 100-200 kcal for the same person, and the activity multiplier adds several hundred more. Every calculator on the internet reports one formula to the calorie. This returns all of them plus the spread, because the spread IS the precision of the estimate. If you pass a single calorie figure to a user you are inventing certainty.
Input: height and weight MUST carry units (178cm, 5'10", 75kg, 165lb, 11st 8lb). sex and age are required by the equations. bodyFatPercent is optional and worth supplying — it adds the Katch-McArdle estimate and moves protein onto lean mass. activity, proteinGoal, targetBmi, and dailyDeficitKcal are optional.
Returns: both unit systems, BMI with WHO category AND the lower cutoffs WHO publishes for South and East Asian populations, every BMR estimate with the spread in calories and percent, a TDEE range, a protein range, an optional target and timeline, warnings, and a disclaimer field.
THIS IS NOT MEDICAL ADVICE and the response says so in its payload, not just on the page. Report the range and the disclaimer to the user. Do not present these figures as clinical guidance, and do not strip the caveats — they are the honest part of the answer.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| age | Yes | Years, 15-100. Outside that the equations do not apply. | |
| sex | Yes | Required by the BMR equations, which are fitted separately. | |
| height | Yes | Height WITH a unit. Accepts 178cm, 1.78m, 5'10", 5 ft 10 in, 70in. A bare number is REFUSED because it is ambiguous. | |
| weight | Yes | Weight WITH a unit. Accepts 75kg, 165lb, 11st 8lb. A bare number is REFUSED. | |
| activity | No | Activity band, default sedentary. This is the LARGEST source of error in the estimate — most people overestimate. If between two bands, take the lower. | |
| targetBmi | No | Target BMI, 15-40, to compute a goal weight. | |
| proteinGoal | No | Which protein guidance range to report. Default maintenance. | |
| bodyFatPercent | No | Optional but worth supplying: adds the Katch-McArdle estimate, which uses lean mass, and moves the protein target onto lean mass. | |
| dailyDeficitKcal | No | Daily deficit, to estimate a timeline. The timeline is a lower bound. |