BMI Calculator
Calculate Body Mass Index with metric and imperial units.
BMI Categories
BMI Calculator computes your Body Mass Index — a widely used screening number derived from your height and weight. BMI = weight (kg) / height² (m²). It categorizes results into Underweight (below 18.5), Normal weight (18.5–24.9), Overweight (25–29.9), and Obese (30 and above), providing a quick reference for health professionals and individuals alike.
Enter your height and weight in either metric (cm/kg) or imperial (ft/lb) units. The tool calculates your BMI instantly and tells you which category you fall into along with the weight range that corresponds to a normal BMI for your height.
BMI is a useful population-level screening tool, but it has limitations: it does not directly measure body fat, and it may misclassify athletes (high muscle mass) or older adults (low muscle mass). Always discuss your results with a healthcare provider for a complete assessment of your health.
Frequently Asked Questions
Code Implementation
def calculate_bmi(weight_kg: float, height_m: float) -> float:
"""Calculate Body Mass Index: BMI = weight(kg) / height(m)^2"""
return weight_kg / (height_m ** 2)
def bmi_from_imperial(weight_lbs: float, height_in: float) -> float:
"""Calculate BMI from imperial units."""
return (weight_lbs / (height_in ** 2)) * 703
def classify_bmi(bmi: float) -> str:
"""Classify BMI using WHO categories."""
if bmi < 18.5:
return "Underweight"
elif bmi < 25.0:
return "Normal weight"
elif bmi < 30.0:
return "Overweight"
elif bmi < 35.0:
return "Obese (Class I)"
elif bmi < 40.0:
return "Obese (Class II)"
else:
return "Obese (Class III)"
# Examples
people = [
("Person A", 55, 1.70),
("Person B", 70, 1.75),
("Person C", 90, 1.75),
("Person D", 110, 1.75),
("Person E", 50, 1.80),
]
print(f"{'Name':<12} {'Weight':>8} {'Height':>7} {'BMI':>6} {'Category'}")
print("-" * 55)
for name, w, h in people:
bmi = calculate_bmi(w, h)
print(f"{name:<12} {w:>7} kg {h:>5} m {bmi:>6.1f} {classify_bmi(bmi)}")
# Imperial example
bmi_imp = bmi_from_imperial(154, 68) # 154 lbs, 5'8"
print(f"\nImperial: 154 lbs / 68 in → BMI {bmi_imp:.1f} ({classify_bmi(bmi_imp)})")Comments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.