function calculateWHR() {
var ageInput = document.getElementById('whrAge').value;
var rhrInput = document.getElementById('whrRHR').value;
var minIntInput = document.getElementById('whrMinIntensity').value;
var maxIntInput = document.getElementById('whrMaxIntensity').value;
var resultDiv = document.getElementById('whr-result');
var age = parseFloat(ageInput);
var rhr = parseFloat(rhrInput);
var minInt = parseFloat(minIntInput);
var maxInt = parseFloat(maxIntInput);
if (isNaN(age) || isNaN(rhr) || isNaN(minInt) || isNaN(maxInt) || age <= 0 || rhr <= 0 || minInt <= 0 || maxInt = maxInt) {
alert("Lower intensity percentage must be less than upper intensity percentage.");
resultDiv.style.display = 'none';
return;
}
// 1. Calculate Maximum Heart Rate (MHR) using standard 220 – age formula
var mhr = 220 – age;
// 2. Calculate Heart Rate Reserve (HRR) – Karvonen method key step
var hrr = mhr – rhr;
// 3. Calculate Lower Target Heart Rate
// Formula: (HRR * (minInt / 100)) + RHR
var lowerTarget = Math.round((hrr * (minInt / 100)) + rhr);
// 4. Calculate Upper Target Heart Rate
// Formula: (HRR * (maxInt / 100)) + RHR
var upperTarget = Math.round((hrr * (maxInt / 100)) + rhr);
// Display results
document.getElementById('resultMHR').innerText = mhr;
document.getElementById('resultHRR').innerText = hrr;
document.getElementById('resultTargetZone').innerText = lowerTarget + " – " + upperTarget;
resultDiv.style.display = 'block';
}
Understanding Your Working Heart Rate
Knowing your working heart rate, also known as your target heart rate zone, is crucial for maximizing the efficiency of your workouts while ensuring safety. Exercising within specific heart rate zones allows you to target different fitness goals, such as fat burning, aerobic endurance, or anaerobic performance.
This calculator uses the Karvonen Formula, which is widely considered more accurate than standard percentages because it takes your individual fitness level into account via your Resting Heart Rate (RHR).
The Importance of the Karvonen Formula
Standard formulas simply take a percentage of your Maximum Heart Rate (MHR). The Karvonen formula first calculates your "Heart Rate Reserve" (HRR), which is the difference between your maximum and resting heart rates. It applies the desired intensity percentage to this reserve and then adds your resting heart rate back in. This ensures that someone with a lower resting heart rate (indicating better fitness) has a slightly different target zone than someone of the same age less fit.
How to Gather Your Inputs
Age: Used to estimate your Maximum Heart Rate (usually 220 minus age).
Resting Heart Rate (RHR): The number of beats per minute while completely at rest. The best time to measure this is in the morning, right after waking up and before getting out of bed. A typical adult RHR is between 60–100 bpm, whereas athletes may be as low as 40 bpm.
Intensity Percentages: These determine your training zone.
Moderate Intensity (e.g., 50% – 70%): Good for warmup, fat metabolization, and basic endurance.
Let's look at an example using the Karvonen method used by this calculator. Consider a 45-year-old individual with a Resting Heart Rate of 65 bpm who wants to train at a moderate intensity between 60% and 75%.