Calculate Metabolic Rate Formula

Basal Metabolic Rate (BMR) Calculator

Your Basal Metabolic Rate (BMR) is the number of calories your body needs to perform basic, life-sustaining functions at rest. This includes breathing, circulation, cell production, and nutrient processing. Factors like age, sex, weight, and height influence your BMR. Understanding your BMR is crucial for managing your weight, as it forms the baseline for your total daily energy expenditure.

Male Female
function calculateBMR() { var weight = document.getElementById("weight").value; var height = document.getElementById("height").value; var age = document.getElementById("age").value; var gender = document.getElementById("gender").value; var bmrResultDiv = document.getElementById("bmrResult"); var weightNum = parseFloat(weight); var heightNum = parseFloat(height); var ageNum = parseFloat(age); if (isNaN(weightNum) || isNaN(heightNum) || isNaN(ageNum) || weightNum <= 0 || heightNum <= 0 || ageNum <= 0) { bmrResultDiv.innerHTML = "Please enter valid positive numbers for weight, height, and age."; return; } var bmr = 0; if (gender === "male") { // Mifflin-St Jeor Equation for Men bmr = (10 * weightNum) + (6.25 * heightNum) – (5 * ageNum) + 5; } else { // Mifflin-St Jeor Equation for Women bmr = (10 * weightNum) + (6.25 * heightNum) – (5 * ageNum) – 161; } bmrResultDiv.innerHTML = "Your estimated Basal Metabolic Rate (BMR) is: " + bmr.toFixed(2) + " calories/day"; } .metabolic-calculator { font-family: sans-serif; max-width: 600px; margin: 20px auto; padding: 20px; border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); } .metabolic-calculator h2 { text-align: center; color: #333; margin-bottom: 15px; } .metabolic-calculator p { color: #555; line-height: 1.6; margin-bottom: 25px; text-align: justify; } .calculator-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-bottom: 20px; } .input-group { display: flex; flex-direction: column; } .input-group label { margin-bottom: 5px; font-weight: bold; color: #444; } .input-group input[type="number"], .input-group select { padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 1rem; } .calculator-inputs button { grid-column: 1 / -1; /* Span across all columns */ padding: 12px 20px; background-color: #007bff; color: white; border: none; border-radius: 4px; font-size: 1.1rem; cursor: pointer; transition: background-color 0.3s ease; } .calculator-inputs button:hover { background-color: #0056b3; } .calculator-result { margin-top: 20px; padding: 15px; background-color: #e9ecef; border: 1px solid #ced4da; border-radius: 4px; text-align: center; font-size: 1.2rem; color: #333; } .calculator-result strong { color: #007bff; }

Leave a Comment