Best Heart Rate Calculator
Understanding your target heart rate zones is crucial for effective and safe exercise. Whether you're aiming for fat burning, improved cardiovascular fitness, or peak performance, knowing your target heart rate helps you train smarter. This calculator will help you determine your maximum heart rate and then calculate your target heart rate zones based on your age.
Age (years):
Calculate Target Heart Rates
function calculateHeartRate() {
var ageInput = document.getElementById("age");
var age = parseFloat(ageInput.value);
var resultDiv = document.getElementById("result");
var maxHeartRateResult = document.getElementById("maxHeartRateResult");
var fatBurningZoneResult = document.getElementById("fatBurningZoneResult");
var aerobicZoneResult = document.getElementById("aerobicZoneResult");
var anaerobicZoneResult = document.getElementById("anaerobicZoneResult");
// Clear previous results
maxHeartRateResult.textContent = "";
fatBurningZoneResult.textContent = "";
aerobicZoneResult.textContent = "";
anaerobicZoneResult.textContent = "";
resultDiv.style.display = "none";
if (isNaN(age) || age <= 0) {
alert("Please enter a valid age.");
return;
}
// Maximum Heart Rate (MHR) Formula: 220 – age
var maxHeartRate = 220 – age;
// Target Heart Rate Zones:
// Fat Burning Zone: 50% – 60% of MHR
// Aerobic Zone: 60% – 80% of MHR
// Anaerobic Zone: 80% – 90% of MHR
var fatBurningLower = Math.round(maxHeartRate * 0.50);
var fatBurningUpper = Math.round(maxHeartRate * 0.60);
var aerobicLower = Math.round(maxHeartRate * 0.60);
var aerobicUpper = Math.round(maxHeartRate * 0.80);
var anaerobicLower = Math.round(maxHeartRate * 0.80);
var anaerobicUpper = Math.round(maxHeartRate * 0.90);
maxHeartRateResult.textContent = "Estimated Maximum Heart Rate: " + maxHeartRate + " bpm";
fatBurningZoneResult.textContent = "Fat Burning Zone (50-60%): " + fatBurningLower + " – " + fatBurningUpper + " bpm";
aerobicZoneResult.textContent = "Aerobic Zone (60-80%): " + aerobicLower + " – " + aerobicUpper + " bpm";
anaerobicZoneResult.textContent = "Anaerobic Zone (80-90%): " + anaerobicLower + " – " + anaerobicUpper + " bpm";
resultDiv.style.display = "block";
}
.calculator-container {
font-family: Arial, sans-serif;
max-width: 500px;
margin: 20px auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 8px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.calculator-container h2 {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.calculator-container p {
line-height: 1.6;
color: #555;
margin-bottom: 20px;
}
.input-section {
margin-bottom: 15px;
display: flex;
align-items: center;
justify-content: space-between;
}
.input-section label {
font-weight: bold;
color: #444;
flex: 1;
}
.input-section input[type="number"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
width: 60%;
box-sizing: border-box;
}
.button-section {
text-align: center;
margin-top: 20px;
margin-bottom: 20px;
}
.button-section button {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.button-section button:hover {
background-color: #45a049;
}
#result {
margin-top: 20px;
padding: 15px;
border-top: 1px solid #eee;
background-color: #f9f9f9;
border-radius: 4px;
display: none; /* Initially hidden */
}
#result p {
margin-bottom: 8px;
color: #333;
}