Heart Rate Ecg Calculator

This calculator helps you determine your heart rate directly from an electrocardiogram (ECG) reading. The heart rate is calculated based on the time between successive R-waves (the tall peak in the QRS complex) on the ECG strip.

Alternatively, if you know the paper speed and the number of small boxes between R-waves:

function calculateHeartRate() { var rrIntervalInput = document.getElementById("rrInterval"); var paperSpeedInput = document.getElementById("paperSpeed"); var smallBoxesInput = document.getElementById("smallBoxes"); var resultDiv = document.getElementById("result"); var rrInterval = parseFloat(rrIntervalInput.value); var paperSpeed = parseFloat(paperSpeedInput.value); var smallBoxes = parseFloat(smallBoxesInput.value); var heartRate = NaN; // Initialize as Not a Number if (!isNaN(rrInterval) && rrInterval > 0) { // Method 1: Using R-R interval in seconds // Heart Rate (bpm) = 60 / R-R interval (seconds) heartRate = 60 / rrInterval; } else if (!isNaN(paperSpeed) && paperSpeed > 0 && !isNaN(smallBoxes) && smallBoxes > 0) { // Method 2: Using paper speed and number of small boxes // Time for one small box = 1 second / paper speed (mm/sec) / (mm per small box, typically 1mm) // R-R interval (seconds) = Number of small boxes * (1 / paper speed) // Heart Rate (bpm) = 60 / R-R interval (seconds) // Simplified: Heart Rate (bpm) = 60 * paper speed / Number of small boxes heartRate = (60 * paperSpeed) / smallBoxes; } if (!isNaN(heartRate)) { resultDiv.innerHTML = "

Calculated Heart Rate:

" + heartRate.toFixed(0) + " bpm"; } else { resultDiv.innerHTML = "Please enter valid numbers for R-R interval or paper speed and small boxes."; } } #ecgHeartRateCalculator { font-family: sans-serif; padding: 20px; border: 1px solid #ccc; border-radius: 5px; max-width: 500px; margin: 20px auto; background-color: #f9f9f9; } .calculator-inputs { margin-bottom: 15px; } .input-group { margin-bottom: 10px; } .input-group label { display: block; margin-bottom: 5px; font-weight: bold; } .input-group input[type="number"] { width: calc(100% – 12px); padding: 8px; border: 1px solid #ccc; border-radius: 3px; } button { padding: 10px 15px; background-color: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; } button:hover { background-color: #45a049; } .calculator-result { margin-top: 20px; padding: 15px; border: 1px solid #ddd; border-radius: 4px; background-color: #fff; } .calculator-result h3 { margin-top: 0; color: #333; } .calculator-result p { font-size: 1.2em; color: #007bff; font-weight: bold; }

Leave a Comment