Metabolic Rate Calculator
Your Basal Metabolic Rate (BMR) is the number of calories your body needs to perform basic life-sustaining functions, such as breathing, circulation, and cell production, while at rest. This calculator uses the Mifflin-St Jeor equation, which is considered one of the most accurate BMR formulas.
Gender:
Male
Female
Weight (kg):
Height (cm):
Age (years):
Calculate BMR
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;
if (isNaN(weight) || isNaN(height) || isNaN(age) || weight <= 0 || height <= 0 || age <= 0) {
document.getElementById("result").innerHTML = "Please enter valid positive numbers for weight, height, and age.";
return;
}
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("result").innerHTML = "Your estimated Basal Metabolic Rate (BMR) is:
" + bmr.toFixed(2) + " calories per day .";
}
.calculator-container {
font-family: sans-serif;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
max-width: 400px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
margin-bottom: 15px;
color: #333;
}
.input-section {
margin-bottom: 15px;
display: flex;
align-items: center;
justify-content: space-between;
}
.input-section label {
margin-right: 10px;
font-weight: bold;
color: #555;
flex-basis: 40%;
}
.input-section input, .input-section select {
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
width: 60%;
box-sizing: border-box;
}
.calculator-container button {
display: block;
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.calculator-container button:hover {
background-color: #45a049;
}
#result {
margin-top: 20px;
padding: 15px;
background-color: #e7f3fe;
border: 1px solid #b3e5fc;
border-radius: 4px;
text-align: center;
font-size: 1.1em;
color: #333;
}
#result strong {
color: #007bff;
}