Mortgage Calculator Mortgage Rates

BMI Calculator

A Body Mass Index (BMI) calculator helps you estimate your body fat based on your height and weight. It's a simple screening tool, but it doesn't diagnose body composition or health.

Understanding Your BMI

BMI is calculated using the formula: weight (kg) / [height (m)]². The resulting number falls into different categories, which can give you a general idea of your weight status:

  • Below 18.5: Underweight
  • 18.5 – 24.9: Normal weight
  • 25.0 – 29.9: Overweight
  • 30.0 and above: Obesity

It's important to remember that BMI is a general guideline and doesn't account for factors like muscle mass, bone density, or body composition. Consult with a healthcare professional for personalized health advice.

#bmi-calculator-container { font-family: sans-serif; border: 1px solid #ccc; padding: 20px; border-radius: 8px; max-width: 400px; margin: 20px auto; background-color: #f9f9f9; } .input-section { margin-bottom: 15px; } .input-section label { display: block; margin-bottom: 5px; font-weight: bold; } .input-section input[type="number"] { width: calc(100% – 12px); padding: 8px; border: 1px solid #ccc; border-radius: 4px; } button { background-color: #4CAF50; color: white; padding: 10px 15px; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; width: 100%; margin-bottom: 15px; } button:hover { background-color: #45a049; } .result-section { margin-top: 20px; padding: 15px; background-color: #e0f7fa; border: 1px solid #00bcd4; border-radius: 4px; text-align: center; font-size: 18px; font-weight: bold; } h2, h3 { text-align: center; color: #333; } ul { list-style-type: disc; margin-left: 20px; } li { margin-bottom: 8px; } function calculateBMI() { var weightKg = parseFloat(document.getElementById("weightKg").value); var heightCm = parseFloat(document.getElementById("heightCm").value); if (isNaN(weightKg) || isNaN(heightCm) || weightKg <= 0 || heightCm <= 0) { document.getElementById("bmi-result").innerHTML = "Please enter valid positive numbers for weight and height."; return; } var heightM = heightCm / 100; var bmi = weightKg / (heightM * heightM); bmi = bmi.toFixed(1); // Display BMI with one decimal place var bmiCategory = ""; if (bmi = 18.5 && bmi = 25.0 && bmi <= 29.9) { bmiCategory = "Overweight"; } else { bmiCategory = "Obesity"; } document.getElementById("bmi-result").innerHTML = "Your BMI is: " + bmi + " (" + bmiCategory + ")"; }

Leave a Comment