Maximum Heart Rate Calculator
Understanding your maximum heart rate is a crucial aspect of designing an effective and safe exercise program. It represents the highest number of times your heart can beat per minute during strenuous physical activity. Knowing this value helps you determine appropriate training zones for different fitness goals, whether it's endurance, fat burning, or high-intensity interval training. There are several formulas to estimate maximum heart rate, but the most commonly used and simplest is the Tanaka formula.
Age (years):
Calculate Maximum Heart Rate
function calculateMaxHeartRate() {
var ageInput = document.getElementById("age");
var resultDiv = document.getElementById("result");
// Clear previous results
resultDiv.innerHTML = "";
var age = parseFloat(ageInput.value);
if (isNaN(age) || age <= 0) {
resultDiv.innerHTML = "Please enter a valid age (a positive number).";
return;
}
// Tanaka formula: Max Heart Rate = 208 – (0.7 * Age)
var maxHeartRate = 208 – (0.7 * age);
resultDiv.innerHTML = "Estimated Maximum Heart Rate:
" + maxHeartRate.toFixed(0) + " bpm ";
}
.calculator-wrapper {
font-family: Arial, sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 400px;
margin: 20px auto;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.calculator-wrapper h2 {
text-align: center;
margin-bottom: 15px;
color: #333;
}
.calculator-wrapper p {
line-height: 1.6;
color: #555;
margin-bottom: 20px;
}
.input-section {
margin-bottom: 15px;
}
.input-section label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #444;
}
.input-section input[type="number"] {
width: calc(100% – 12px);
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 1rem;
}
.button-section {
text-align: center;
margin-bottom: 20px;
}
.button-section button {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
transition: background-color 0.3s ease;
}
.button-section button:hover {
background-color: #45a049;
}
.result-section {
margin-top: 20px;
padding: 15px;
background-color: #eef;
border: 1px solid #ddd;
border-radius: 4px;
text-align: center;
}
.result-section p {
margin: 0;
font-size: 1.1rem;
color: #333;
}
.result-section strong {
color: #007bff;
}