Your BMR is:
— kcal/day
This is the number of calories your body burns at rest. To determine your Total Daily Energy Expenditure (TDEE) for weight loss, you'll need to factor in your activity level. A common starting point for weight loss is to aim for a calorie deficit of 500-1000 calories per day below your TDEE, which can lead to a loss of 1-2 pounds per week.
.calculator-wrapper {
font-family: sans-serif;
display: flex;
flex-wrap: wrap;
gap: 30px;
margin: 20px 0;
border: 1px solid #e0e0e0;
padding: 20px;
border-radius: 8px;
background-color: #f9f9f9;
}
.calculator-form {
flex: 1;
min-width: 300px;
}
.calculator-result {
flex: 1;
min-width: 300px;
background-color: #fff;
padding: 15px;
border-radius: 5px;
border: 1px solid #ddd;
text-align: center;
}
.calculator-result h3 {
margin-top: 0;
color: #333;
}
#result {
font-size: 2em;
font-weight: bold;
color: #007bff;
margin-bottom: 15px;
}
.form-group {
margin-bottom: 15px;
}
.form-group label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.form-group input[type="number"],
.form-group input[type="text"] {
width: calc(100% – 22px);
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.radio-group {
display: flex;
align-items: center;
gap: 10px;
}
.radio-group label {
font-weight: normal;
margin-bottom: 0;
}
button {
background-color: #007bff;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1em;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #0056b3;
}
function calculateBMR() {
var weight = parseFloat(document.getElementById("weight").value);
var height = parseFloat(document.getElementById("height").value);
var age = parseFloat(document.getElementById("age").value);
var gender = document.querySelector('input[name="gender"]:checked').value;
var bmr = 0;
if (isNaN(weight) || isNaN(height) || isNaN(age) || weight <= 0 || height <= 0 || age <= 0) {
document.getElementById("result").innerText = "Invalid input";
return;
}
// Using the Mifflin-St Jeor Equation, which is generally considered more 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("result").innerText = Math.round(bmr) + " kcal/day";
}