How Our BMI Calculator Works: The Formula, the Cutoffs, and the Edge Cases

Most BMI articles restate the same category table and stop. This one walks through the

actual calculator we ship, line by line, including the inputs it rejects, the inputs it

answers wrongly, and the design decisions behind them. You will know exactly what the

number on screen means and where it stops meaning anything.

The formula our implementation runs

The BMI tab in our calculators page takes height in centimeters and weight in kilograms.

The entire computation is one line:

bmi = weight / (height / 100) ** 2

There is no imperial branch. If you think in pounds and inches, convert first, because

typing 70 into the height field as if it were inches produces a nonsense score. The

defaults shipped in the component are 175 cm and 70 kg, which yield 22.9 after rounding.

That value sits in the middle of the normal band and works as a sanity check that the

page is behaving.

The result renders with one decimal, using fixed-point rounding. A raw score of 24.96

displays as 25.0 and therefore flips to the overweight label. Scores close to a cutoff

deserve a second measurement before you act on them.

The four cutoffs and how the code branches

The component assigns categories with three comparisons evaluated in order:

1. Below 18.5, the label is Underweight and the indicator is blue.

2. Below 25, the label is Normal and the indicator is green.

3. Below 30, the label is Overweight and the indicator is yellow.

4. At 30 and above, the label is Obese and the indicator is red.

These match the widely used WHO cutoffs. The component stops there. It does not split

obesity into class I, II, and III, so a score of 31 and a score of 41 receive the same

label and color. If you need the finer classes for a conversation with a doctor, apply

them yourself: 30 to 34.9, 35 to 39.9, and 40 and above.

The color bar under the result maps a score of 10 to the left edge and 50 to the right

edge, clamped. Your position is the percentage of that span. A score above 50 pins to

the right end rather than running off the bar.

Edge cases, taken from the guard clauses

The result block only renders when the computed value is a number and greater than

zero. That guard produces specific behavior you should know about:

  • Empty fields parse to NaN, so you see no result at all. Correct behavior.
  • A negative weight produces a negative score, which the greater-than-zero guard

hides. Correct behavior, silently.

  • A height of zero divides by zero and yields Infinity, which passes the guard. The

page displays Infinity with the Obese label. Treat a zero height entry as invalid

input and retype it.

That third case is a real bug-shaped edge in our own code, and we state it because

every BMI calculator has corners like this. Ours at least fails visibly.

What BMI cannot tell you

The formula uses two inputs, so it can only see mass relative to height. It cannot

distinguish muscle from fat, it cannot see fat distribution, and it says nothing about

cardiovascular fitness. The index was designed in the 1830s by the Belgian

mathematician Adolphe Quetelet as a population statistic, and that origin matters.

Screening large groups and diagnosing one person are different jobs.

Concretely, expect misleading scores in these situations:

  • People who lift seriously often score overweight while carrying little fat.
  • Adults over roughly 65 often score normal while having lost muscle mass.
  • Children and teenagers need age-specific charts. Do not apply adult cutoffs to them.
  • Pregnancy changes both inputs in ways the formula was never meant to compare.

Use the score as one data point. Track its trend over months, in the morning, under

the same conditions, and pair it with waist measurement or a body composition reading

before drawing conclusions.

How to measure so the number is comparable

Garbage inputs produce a confident-looking but useless score. Follow one sequence every

time:

1. Measure height once with shoes off, against a wall, and reuse that value.

2. Weigh yourself in the morning, after the bathroom, before eating or drinking.

3. Enter both values, read the score, and write down the date next to it.

4. Repeat weekly at most. Daily readings mostly track water.

5. Compare only measurements taken under those same conditions.

If two consecutive monthly readings move in the same direction, believe the trend. If

they bounce by more than a point, check your measurement routine before checking your

diet.

Checklist before you trust a BMI score

  • Height is in centimeters and the value is your measured height, zero excluded.
  • Weight is in kilograms, taken under repeatable conditions.
  • You noted the date, because single scores mean less than trends.
  • You are an adult, not pregnant, and not applying this to a child.
  • You treat 18.5, 25, and 30 as screening thresholds, not diagnoses.
  • You remember the display rounds to one decimal near cutoffs.

BMI survives because it costs nothing and tracks population risk reasonably well. It

fails as a solo instrument, and no rounding behavior fixes that. Measure it properly,

watch the trend, and bring the number to a professional when it moves.

Have you tracked your score over time, and did the trend or a single reading drive your

last decision about it? Run your numbers through our

[BMI calculator](https://webrecast.com/en/bmi-calculator) and check the category

branching yourself against the cutoffs above.