Running Heart Rate Zone Calculator
Understanding your heart rate zones during a run is crucial for effective training, whether your goal is to build aerobic base, improve speed, or recover. This calculator helps you estimate your target heart rate zones based on your maximum heart rate.
Age (years):
Resting Heart Rate (bpm):
Calculate Zones
.calculator-container {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 400px;
margin: 20px auto;
background-color: #f9f9f9;
}
.calculator-container h2 {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.calculator-container p {
font-size: 0.9em;
color: #555;
text-align: justify;
margin-bottom: 20px;
line-height: 1.5;
}
.input-section {
margin-bottom: 15px;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
align-items: center;
}
.input-section label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #444;
text-align: right;
}
.input-section input {
width: calc(100% – 10px);
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.calculator-container button {
display: block;
width: 100%;
padding: 10px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1em;
margin-top: 10px;
}
.calculator-container button:hover {
background-color: #0056b3;
}
#result {
margin-top: 20px;
padding: 15px;
border: 1px solid #d4edda;
background-color: #d4edda;
color: #155724;
border-radius: 4px;
font-size: 0.95em;
text-align: left;
}
#result h3 {
margin-top: 0;
color: #155724;
}
#result ul {
list-style-type: none;
padding: 0;
margin: 0;
}
#result li {
margin-bottom: 8px;
}
.zone-label {
font-weight: bold;
}
function calculateHeartRateZones() {
var age = document.getElementById("age").value;
var restingHeartRate = document.getElementById("restingHeartRate").value;
var resultDiv = document.getElementById("result");
resultDiv.innerHTML = "; // Clear previous results
// Validate inputs
if (age === "" || restingHeartRate === "") {
resultDiv.innerHTML = "Please enter both age and resting heart rate.";
return;
}
var ageNum = parseFloat(age);
var restingHeartRateNum = parseFloat(restingHeartRate);
if (isNaN(ageNum) || isNaN(restingHeartRateNum) || ageNum <= 0 || restingHeartRateNum <= 0) {
resultDiv.innerHTML = "Please enter valid positive numbers for age and resting heart rate.";
return;
}
// Karvonen Formula for Maximum Heart Rate
// MHR = 220 – Age (a common, though not perfectly accurate, estimation)
// Heart Rate Reserve (HRR) = MHR – Resting Heart Rate
// Target Heart Rate = (HRR * % intensity) + Resting Heart Rate
var maxHeartRate = 220 – ageNum;
var heartRateReserve = maxHeartRate – restingHeartRateNum;
var zones = {
"Zone 1 (Very Light)": { minPercent: 0.50, maxPercent: 0.60 },
"Zone 2 (Light)": { minPercent: 0.60, maxPercent: 0.70 },
"Zone 3 (Moderate)": { minPercent: 0.70, maxPercent: 0.80 },
"Zone 4 (Hard)": { minPercent: 0.80, maxPercent: 0.90 },
"Zone 5 (Maximum)": { minPercent: 0.90, maxPercent: 1.00 }
};
var outputHTML = "
Your Running Heart Rate Zones: ";
for (var zoneName in zones) {
var lowerBound = Math.round((zones[zoneName].minPercent * heartRateReserve) + restingHeartRateNum);
var upperBound = Math.round((zones[zoneName].maxPercent * heartRateReserve) + restingHeartRateNum);
// Ensure bounds don't exceed MHR or go below resting HR conceptually for very low zones
lowerBound = Math.max(lowerBound, restingHeartRateNum);
upperBound = Math.min(upperBound, maxHeartRate);
if (lowerBound <= upperBound) { // Only display if a valid range exists
outputHTML += "" + zoneName + ": " + lowerBound + " – " + upperBound + " bpm ";
}
}
outputHTML += " ";
outputHTML += "
Note: These are estimations. Your actual maximum heart rate may vary. Zone 5 is often for very short, intense efforts.";
resultDiv.innerHTML = outputHTML;
}