Calculate your Body Mass Index (BMI) using the standard formula recommended by the CDC.
Understanding Body Mass Index (BMI)
Body Mass Index (BMI) is a widely used screening tool to categorize a person's weight relative to their height. It helps to identify weight categories that may increase the risk of developing certain health problems. The Centers for Disease Control and Prevention (CDC) uses standard BMI ranges to assess these risks.
BMI is calculated using a simple formula that takes into account a person's weight and height. While it's a useful indicator, it's important to remember that BMI does not directly measure body fat and does not account for factors like muscle mass, bone density, or body composition. Therefore, it should be used as a starting point for discussion with a healthcare provider.
How BMI is Calculated
The standard formula for calculating BMI is:
BMI = Weight (kg) / (Height (m))²
For easier calculation and input, if your height is in centimeters (cm), you first convert it to meters (m) by dividing by 100.
For example, if your height is 175 cm, you convert it to 1.75 meters.
The calculation performed by this calculator is equivalent to:
The CDC uses the following standard categories for adults based on their BMI:
Underweight: BMI less than 18.5
Healthy weight: BMI 18.5 to 24.9
Overweight: BMI 25.0 to 29.9
Obese: BMI 30.0 or greater
It's important to consult with a healthcare professional for personalized advice regarding your weight and health status. They can consider other factors that influence your overall well-being.
function calculateBMI() {
var weightKgInput = document.getElementById("weightKg");
var heightCmInput = document.getElementById("heightCm");
var resultDiv = document.getElementById("result");
var weightKg = parseFloat(weightKgInput.value);
var heightCm = parseFloat(heightCmInput.value);
if (isNaN(weightKg) || isNaN(heightCm) || weightKg <= 0 || heightCm <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for weight and height.";
resultDiv.className = ""; // Reset any previous class
return;
}
var heightM = heightCm / 100;
var bmi = weightKg / (heightM * heightM);
var bmiRounded = bmi.toFixed(1); // Round to one decimal place
var bmiCategory = "";
var resultMessage = "Your BMI: " + bmiRounded + " – ";
if (bmi = 18.5 && bmi = 25 && bmi = 30
bmiCategory = "obese";
resultMessage += "Obese. It is recommended to consult a healthcare professional.";
}
resultDiv.innerHTML = resultMessage;
resultDiv.className = bmiCategory; // Apply class for styling
}