Basal Metabolic Rate (BMR) Calculator
Your Basal Metabolic Rate (BMR) is the minimum amount of energy (calories) your body needs to perform its essential functions at rest. This includes breathing, circulation, cell production, and maintaining body temperature. Knowing your BMR can help you understand your basic caloric needs for weight management and overall health.
#bmr-calculator {
font-family: sans-serif;
border: 1px solid #ddd;
padding: 20px;
border-radius: 8px;
max-width: 500px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-inputs {
margin-top: 20px;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
}
.form-group input[type="number"],
.form-group select {
width: calc(100% – 10px);
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
#bmr-calculator button {
background-color: #4CAF50;
color: white;
padding: 10px 15px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
margin-top: 10px;
}
#bmr-calculator button:hover {
background-color: #45a049;
}
.calculator-result {
margin-top: 20px;
padding: 15px;
border: 1px solid #eee;
background-color: #fff;
border-radius: 4px;
text-align: center;
font-size: 1.1em;
}
function calculateBMR() {
var gender = document.getElementById("gender").value;
var weight = parseFloat(document.getElementById("weight").value);
var height = parseFloat(document.getElementById("height").value);
var age = parseFloat(document.getElementById("age").value);
var bmr = 0;
// Validate inputs
if (isNaN(weight) || weight <= 0 || isNaN(height) || height <= 0 || isNaN(age) || age <= 0) {
document.getElementById("bmr-result").innerHTML = "Please enter valid positive numbers for weight, height, and age.";
return;
}
// Mifflin-St Jeor Equation (widely considered the most accurate)
if (gender === "male") {
bmr = (10 * weight) + (6.25 * height) – (5 * age) + 5;
} else { // female
bmr = (10 * weight) + (6.25 * height) – (5 * age) – 161;
}
document.getElementById("bmr-result").innerHTML = "Your Basal Metabolic Rate (BMR) is:
" + bmr.toFixed(2) + " calories per day.";
}