Maximum Heart Rate Calculator
Understanding your maximum heart rate is a key component of a safe and effective exercise program. It helps you gauge the intensity of your workouts. The most common formula used to estimate maximum heart rate is the Tanaka formula. This calculator uses that formula to provide an estimate based on your age.
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 120) {
resultDiv.innerHTML = "Please enter a valid age between 1 and 120.";
return;
}
// Tanaka formula: 208 – (0.7 * age)
var maxHeartRate = 208 – (0.7 * age);
resultDiv.innerHTML = "Your estimated maximum heart rate is:
" + maxHeartRate.toFixed(0) + " beats per minute (bpm) ";
}
.calculator-container {
font-family: Arial, sans-serif;
border: 1px solid #ddd;
padding: 20px;
border-radius: 8px;
max-width: 400px;
margin: 20px auto;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
background-color: #f9f9f9;
}
.calculator-title {
text-align: center;
color: #333;
margin-bottom: 15px;
}
.calculator-description {
color: #555;
line-height: 1.6;
margin-bottom: 20px;
font-size: 0.95em;
}
.calculator-inputs {
margin-bottom: 20px;
}
.input-group {
margin-bottom: 15px;
display: flex;
align-items: center;
justify-content: space-between;
}
.input-group label {
font-weight: bold;
color: #444;
margin-right: 10px;
flex-basis: 40%; /* Adjust label width */
}
.input-group input[type="number"] {
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
width: 60%; /* Adjust input width */
box-sizing: border-box; /* Include padding and border in the element's total width and height */
}
button {
display: block;
width: 100%;
padding: 12px;
background-color: #007bff;
color: white;
border: none;
border-radius: 4px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #0056b3;
}
.calculator-result {
margin-top: 25px;
padding: 15px;
background-color: #e9ecef;
border: 1px solid #ced4da;
border-radius: 4px;
text-align: center;
font-size: 1.1em;
color: #333;
}