function calculateTHR() {
var age = parseFloat(document.getElementById('age').value);
var restingHR = parseFloat(document.getElementById('restingHR').value);
var intensity = parseFloat(document.getElementById('intensity').value) / 100;
if (isNaN(age) || age 120) {
alert("Please enter a valid age.");
return;
}
// Standard Formula
var maxHR = 220 – age;
// Karvonen Formula Logic
var hrResultsDiv = document.getElementById('hr-results');
var maxHRResult = document.getElementById('maxHRResult');
var specificResult = document.getElementById('specificResult');
var moderateZone = document.getElementById('moderateZone');
var vigorousZone = document.getElementById('vigorousZone');
var maxZone = document.getElementById('maxZone');
hrResultsDiv.style.display = 'block';
maxHRResult.innerText = Math.round(maxHR) + " BPM";
if (!isNaN(restingHR) && restingHR > 0) {
var hrr = maxHR – restingHR;
var specificTHR = (hrr * intensity) + restingHR;
specificResult.innerText = Math.round(specificTHR) + " BPM";
var modLow = (hrr * 0.5) + restingHR;
var modHigh = (hrr * 0.7) + restingHR;
moderateZone.innerText = Math.round(modLow) + " – " + Math.round(modHigh) + " BPM";
var vigLow = (hrr * 0.7) + restingHR;
var vigHigh = (hrr * 0.85) + restingHR;
vigorousZone.innerText = Math.round(vigLow) + " – " + Math.round(vigHigh) + " BPM";
var mLow = (hrr * 0.85) + restingHR;
var mHigh = (hrr * 1.0) + restingHR;
maxZone.innerText = Math.round(mLow) + " – " + Math.round(mHigh) + " BPM";
} else {
// Fallback to Fox formula if no resting HR
var specificTHR = maxHR * intensity;
specificResult.innerText = Math.round(specificTHR) + " BPM";
moderateZone.innerText = Math.round(maxHR * 0.5) + " – " + Math.round(maxHR * 0.7) + " BPM";
vigorousZone.innerText = Math.round(maxHR * 0.7) + " – " + Math.round(maxHR * 0.85) + " BPM";
maxZone.innerText = Math.round(maxHR * 0.85) + " – " + Math.round(maxHR) + " BPM";
}
hrResultsDiv.scrollIntoView({ behavior: 'smooth' });
}
Understanding Your Target Heart Rate
Using an online target heart rate calculator is the most efficient way to ensure your workouts are effective and safe. By tracking your Beats Per Minute (BPM), you can determine whether you are working hard enough to see cardiovascular benefits or if you are pushing your body too far.
How the Calculation Works
This calculator primarily uses two methods to determine your training zones:
- The Fox Formula: The simplest calculation (220 – Age) to find your estimated Maximum Heart Rate.
- The Karvonen Formula: A more advanced method that takes your Resting Heart Rate into account. This calculates your Heart Rate Reserve (HRR), which provides a more personalized target based on your current fitness level.
Heart Rate Training Zones Explained
| Zone |
Intensity |
Benefit |
| Warm-up |
50-60% |
Recovery & metabolic health |
| Fat Burn / Aerobic |
60-70% |
Endurance and fat metabolism |
| Vigorous / Anaerobic |
70-85% |
Improved cardio performance |
| Red Line |
85-100% |
Max speed and power |
Practical Examples
Suppose you are 30 years old with a resting heart rate of 60 BPM:
- Max HR: 220 – 30 = 190 BPM.
- Heart Rate Reserve (HRR): 190 – 60 = 130 BPM.
- Target (70% Intensity): (130 * 0.70) + 60 = 151 BPM.
In this example, your goal for a moderate-to-vigorous run would be to keep your heart rate around 151 beats per minute.
Why Track Heart Rate?
Heart rate tracking eliminates the guesswork. Instead of relying on how "tired" you feel, you use biological data to confirm intensity. This helps prevent overtraining, reduces injury risk, and ensures you are training in the specific zone required for your goals (e.g., training for a marathon vs. light weight loss).
Medical Disclaimer: This calculator provides estimates for healthy adults. If you have a heart condition, are pregnant, or are taking medications that affect heart rate (like beta-blockers), please consult a physician before starting a new exercise regimen.