Maximum Heart Rate Calculator
Your maximum heart rate (MHR) is the highest number of times your heart can beat per minute (bpm) during maximum physical exertion. It's a crucial metric for determining appropriate training zones for exercise. A common and simple formula to estimate your MHR is the Tanaka formula: MHR = 208 – (0.7 x Age).
Age (years):
Calculate Maximum Heart Rate
function calculateMaxHeartRate() {
var ageInput = document.getElementById("age");
var resultDiv = document.getElementById("result");
var age = parseFloat(ageInput.value);
if (isNaN(age) || age <= 0) {
resultDiv.innerHTML = "Please enter a valid age greater than 0.";
return;
}
// Tanaka formula: MHR = 208 – (0.7 x Age)
var maxHeartRate = 208 – (0.7 * age);
resultDiv.innerHTML = "Your estimated maximum heart rate is:
" + maxHeartRate.toFixed(0) + " bpm ";
}
.heart-rate-calculator {
font-family: sans-serif;
border: 1px solid #ccc;
padding: 20px;
border-radius: 8px;
max-width: 400px;
margin: 20px auto;
background-color: #f9f9f9;
}
.heart-rate-calculator h2 {
text-align: center;
margin-bottom: 20px;
color: #333;
}
.input-section {
margin-bottom: 15px;
}
.input-section label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
.input-section input[type="number"] {
width: calc(100% – 12px);
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.heart-rate-calculator button {
width: 100%;
padding: 10px 15px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.heart-rate-calculator button:hover {
background-color: #45a049;
}
.result-section {
margin-top: 20px;
padding: 15px;
background-color: #e8f5e9;
border: 1px solid #a5d6a7;
border-radius: 4px;
text-align: center;
color: #2e7d32;
font-size: 1.1em;
}
.result-section strong {
font-weight: bold;
}