Calculate Your Basal Metabolic Rate (BMR)
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, at rest. It's the minimum amount of energy your body requires to keep you alive. Understanding your BMR is a key step in managing your weight and understanding your nutritional needs.
We use the Mifflin-St Jeor equation, which is widely considered one of the most accurate BMR formulas:
- For Men: BMR = (10 × weight in kg) + (6.25 × height in cm) – (5 × age in years) + 5
- For Women: BMR = (10 × weight in kg) + (6.25 × height in cm) – (5 × age in years) – 161
Your Estimated Basal Metabolic Rate:
— kcal/day
function calculateBMR() {
var gender = document.getElementById("gender").value;
var weightKg = parseFloat(document.getElementById("weightKg").value);
var heightCm = parseFloat(document.getElementById("heightCm").value);
var ageYears = parseFloat(document.getElementById("ageYears").value);
var bmr = 0;
if (isNaN(weightKg) || isNaN(heightCm) || isNaN(ageYears) || weightKg <= 0 || heightCm <= 0 || ageYears <= 0) {
document.getElementById("bmrResult").innerHTML = "Please enter valid positive numbers for all fields.";
return;
}
if (gender === "male") {
bmr = (10 * weightKg) + (6.25 * heightCm) – (5 * ageYears) + 5;
} else { // female
bmr = (10 * weightKg) + (6.25 * heightCm) – (5 * ageYears) – 161;
}
document.getElementById("bmrResult").innerHTML = bmr.toFixed(2) + " kcal/day";
}
.calculator-wrapper {
font-family: Arial, sans-serif;
max-width: 600px;
margin: 20px auto;
padding: 20px;
border: 1px solid #e0e0e0;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-wrapper h2, .calculator-wrapper h3 {
text-align: center;
color: #333;
}
.calculator-wrapper p {
line-height: 1.6;
color: #555;
margin-bottom: 15px;
}
.calculator-wrapper ul {
margin-bottom: 20px;
padding-left: 20px;
color: #555;
}
.calculator-wrapper li {
margin-bottom: 8px;
}
.calculator-inputs {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 15px;
margin-bottom: 25px;
}
.form-group {
display: flex;
flex-direction: column;
}
.form-group label {
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.form-group input[type="number"],
.form-group select {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1rem;
box-sizing: border-box; /* Ensure padding and border are included in the element's total width and height */
}
.form-group input[type="number"]::placeholder {
color: #aaa;
}
.calculator-wrapper button {
grid-column: 1 / -1; /* Span 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-wrapper button:hover {
background-color: #0056b3;
}
.calculator-result {
text-align: center;
margin-top: 20px;
padding: 15px;
border: 1px dashed #007bff;
border-radius: 4px;
background-color: #e7f3ff;
}
.calculator-result h3 {
margin-top: 0;
color: #0056b3;
}
#bmrResult {
font-size: 1.5rem;
font-weight: bold;
color: #007bff;
}