Lesson 5 of 20 · Level 1: Foundations

How HRV is measured: from beats to a number

Every HRV number is made in the same four steps: find each heartbeat, measure the gaps between them, throw out bad beats, and turn the remaining gaps into a number. This lesson walks through each step, with a calculation you can do on paper.

On this page 6 sections

Key takeaways

  • Every HRV number comes from the gaps between heartbeats, timed by a sensor that samples many times a second.
  • A slow sampling rate, such as a 25 Hz camera, adds false jumps that push RMSSD up.
  • Bad beats must be found and deleted or filled in first; fixing more than about 5% is a warning sign.
  • RMSSD settles within a minute or two; SDNN keeps growing with recording length, so lengths cannot be mixed.
After this lesson you can
  • Describe how a chest strap (ECG) and a watch or ring (PPG) each find a heartbeat.
  • Calculate RMSSD by hand from five gaps between beats.
  • Explain how sampling rate and beat correction change the result.
  • Say how long a recording each measure needs, and why lengths should not be mixed.

Every HRV number is made in the same four steps: find each heartbeat, measure the gaps between beats, throw out the bad beats, and turn the remaining gaps into one number. This lesson walks through each step, with a calculation you can do on paper.

In lesson 2 you saw the picture behind HRV: a line of gaps between beats that wiggles up and down. In lesson 4 you saw how one bad beat can throw the number off. Now you will see how a device gets from your heartbeat to the number on your screen.

Step 1: find each heartbeat

A device first has to know exactly when each beat happens. There are two main ways to do this.

ECG ECG A recording of the heart's electrical activity, taken with electrodes on the skin. ECG-based RR intervals are the reference standard for measuring HRV. More about ECG (chest straps and medical ECGs). Electrodes on the skin pick up the heart’s electrical signal. Every beat makes a tall, sharp spike called the R peak. Because the spike is so sharp, software can time it very precisely. That is why the ECG is the gold standard for HRV.

PPG PPG An optical method that shines light into the skin and detects the pulse of blood with each heartbeat. Most watches, rings and phone-camera apps use it to estimate HRV. More about PPG (watches, rings and phone cameras). An optical sensor shines light into the skin and measures how much comes back. With each heartbeat, a pulse of blood passes under the sensor and changes the signal. The device times each pulse wave instead of each electrical beat.

The pulse wave reaches your wrist or finger a moment after the heart beats. So, strictly speaking, optical devices measure pulse rate variability Pulse rate variability Variation in the time between pulse beats, measured optically by watches, rings and phone cameras. It closely tracks HRV at rest but drifts from it during movement. More about Pulse rate variability , not heart rate variability. At rest, the two agree well enough for most uses. Optical readings tend to show slightly more short-term variability than the ECG does, partly because breathing affects the pulse on its way to the skin. The match gets much worse when you move. Phone camera apps work on the same principle; see can a phone camera measure HRV.

How often the sensor looks

A sensor does not watch your heart all the time. It takes snapshots, many times a second. The number of snapshots a second is the sampling rate Sampling rate How many times a second a sensor measures the signal, in hertz (Hz). It sets how precisely each beat can be timed: about ±1 ms at 1000 Hz, ±4 ms at 250 Hz and ±20 ms at a 25 Hz camera. More about Sampling rate , in hertz (Hz). A device can only place a beat on one of its snapshots, so a beat’s time is rounded to the nearest one.

Rounding to the nearest snapshot moves a beat by at most half the gap between snapshots. At 1000 Hz the snapshots are 1 ms apart, so a beat lands within 0.5 ms of its true time; at 250 Hz, within 2 ms. A phone camera takes about 25 to 30 pictures a second, so each beat can be off by up to 20 ms. The 2024 research guidelines quote a more cautious figure, a whole gap (±1 ms at 1000 Hz, ±4 ms at 250 Hz), and recommend 1000 Hz (Quigley and colleagues, 2024).

This matters most for RMSSD RMSSD Root mean square of successive differences: an HRV metric built from how much each heartbeat interval differs from the next, in milliseconds. It mainly reflects vagal activity. More about RMSSD . RMSSD measures the change from one gap to the next, and rounding errors look exactly like such changes. Time every beat of this course’s five-minute teaching recording to the nearest of 25 pictures a second, and RMSSD reads 31% too high, about a third. Software can win much of this back by estimating where the pulse peak fell between two pictures. Lesson 16, in the Analyst level, lets you try every sampling rate yourself: from electrode to number.

Step 2: measure the gaps

Next, the device measures the time from each beat to the next, in milliseconds (ms). These are the RR intervals RR interval The time from one heartbeat to the next, measured in milliseconds between the R peaks of an ECG. HRV is calculated from a series of these intervals. More about RR interval you met in lesson 1. A short list might look like this:

810, 830, 790, 850, 820 ms

That is five gaps between six beats. The average gap is 820 ms, which works out to about 73 beats per minute.

Step 3: clean the list

Real recordings are messy. A device can:

  • miss a beat (one gap looks twice as long as it should)
  • count a beat that wasn’t there (one gap is split into two short ones)
  • catch a real extra beat from outside the normal pacemaker Sinus node The heart's natural pacemaker, a small patch of cells that starts every normal heartbeat. Left alone it fires about 100 times a minute; the vagus nerve holds it lower at rest. More about Sinus node , an ectopic beat Ectopic beat A heartbeat that starts outside the heart's normal pacemaker and usually comes early. Ectopic beats are common, but they distort HRV unless removed or corrected. More about Ectopic beat
  • pick up noise from movement or a loose strap

Each of these creates a false jump between neighbouring gaps. As you saw in lesson 4, one such jump can multiply RMSSD many times over. In short recordings, even a few edited beats (under 5% of them) can change the result.

So before calculating, software cleans the list in two steps. The gaps that are left, between normal beats, are called NN intervals NN interval An RR interval between two normal heartbeats, in milliseconds, after extra beats and measurement errors are removed. Most HRV metrics are calculated from NN intervals. More about NN interval (“normal-to-normal”).

First, find the bad gaps. The usual rule compares each gap with its neighbours and flags any that differ from them by more than a set amount. A strict rule catches small errors but starts flagging real beats; a loose one lets errors through.

Then, fix them. The software either deletes the bad gap or fills it with a value made from the good gaps around it. Filling keeps the recording’s rhythm in step, which matters for some measures; deleting is simpler (Peltola, 2012).

How much fixing is too much? Editing even under 5% of the gaps can change short-term results, and many studies throw out a recording with under 80% normal beats (Peltola, 2012). The guide to Kubios, a widely used research program, recommends keeping corrected beats Beat correction Finding the beat intervals that are wrong (missed, extra or ectopic beats) and deleting or replacing them before HRV is calculated. The rule of thumb is to correct under 5% of beats. More about Beat correction under 5% (Alcantara and colleagues, 2020).

Lesson 16 names the cleaning methods, compares them on a five-minute recording and lets you plant a bad beat and clean it yourself.

You never see this step. Your app does it quietly, using its own method and threshold. That is one reason two devices can give different numbers for the same night.

Step 4: turn the gaps into a number

Now for the maths. The main short-term HRV measure is RMSSD, short for “root mean square of successive differences”. The name sounds hard, but it is just four small steps, done in reverse order of the words.

Take our five gaps:

Gap (ms)Difference from the gap before (ms)Difference squared
810
830+20400
790−401,600
850+603,600
820−30900
  1. Successive differences. Subtract each gap from the next one: +20, −40, +60, −30.
  2. Square. Multiply each difference by itself: 400, 1,600, 3,600, 900. Squaring makes every value positive, so a drop counts as much as a rise. It also gives big jumps extra weight.
  3. Mean. Average the squares: 6,500 ÷ 4 = 1,625.
  4. Root. Take the square root: √1,625 ≈ 40.

RMSSD for these five gaps is about 40 ms. In plain words, from one beat to the next, the gap changed by about 40 ms on a typical step.

Now try it on a longer list. The widget below works RMSSD out step by step from ten beats of the site’s teaching recording. Press Next to move through the steps, or change any beat and watch every step update.

RMSSD step by step

Ten beats, every number shown

The ten intervals, in ms (300 to 2000)

RMSSD of these 10 intervals is 26.9 ms.

Step 5 of 5

  1. Step 1 of 5 Start with the intervals

    Beat 1880 ms
    Beat 2826 ms
    Beat 3812 ms
    Beat 4823 ms
    Beat 5848 ms
    Beat 6877 ms
    Beat 7880 ms
    Beat 8866 ms
    Beat 9828 ms
    Beat 10815 ms

    10 intervals between 11 beats, in milliseconds.

  2. Step 2 of 5 Subtract each interval from the next

    Beat 2 − beat 1−54 ms
    Beat 3 − beat 2−14 ms
    Beat 4 − beat 3+11 ms
    Beat 5 − beat 4+25 ms
    Beat 6 − beat 5+29 ms
    Beat 7 − beat 6+3 ms
    Beat 8 − beat 7−14 ms
    Beat 9 − beat 8−38 ms
    Beat 10 − beat 9−13 ms

    Plus means the heart slowed down for a beat; minus means it sped up.

  3. Step 3 of 5 Square each difference

    Difference 12916
    Difference 2196
    Difference 3121
    Difference 4625
    Difference 5841
    Difference 69
    Difference 7196
    Difference 81444
    Difference 9169
    Sum6517

    Squaring makes every value positive and gives big changes more weight.

  4. Step 4 of 5 Average the squares

    6517 ÷ 9724.11
  5. Step 5 of 5 Take the square root

    √724.1126.9 ms

    RMSSD 26.9 ms

With JavaScript on, the steps show one at a time and the beats can be changed.

RMSSD worked out from ten beats of the teaching recording, one step at a time. Change any beat and every step updates.

A row of ten editable heartbeat intervals in milliseconds, then the calculation of RMSSD as numbered steps: start with the intervals; subtract each interval from the next; square each difference; average the squares; take the square root. The final step reads RMSSD 26.9 ms. Back and Next buttons move between the steps.

You’ll often see a second measure next to it, SDNN SDNN The standard deviation of all NN intervals in a recording, in milliseconds. It measures overall variability, and its value depends strongly on how long the recording lasts. More about SDNN . It is the standard deviation of all the gaps, which shows how spread out they are around their average. For our five gaps, SDNN is about 22 ms. Lesson 6 compares the two.

Go deeper The RMSSD formula in symbols

Write the gaps as RR₁, RR₂, … RRₙ. The successive differences are dᵢ = RRᵢ₊₁ − RRᵢ, and there are n − 1 of them.

RMSSD = √( (d₁² + d₂² + … + dₙ₋₁²) ÷ (n − 1) )

With our five gaps, n − 1 = 4 differences, so we divide the sum of squares (6,500) by 4. Real software runs this on cleaned NN intervals, using its own cleaning and averaging, so its result may not match a hand calculation exactly.

SDNN uses the distance of every gap from the average gap instead: square each distance, add them up, divide by n − 1, and take the square root. For 810, 830, 790, 850 and 820, the distances from 820 are −10, +10, −30, +30 and 0. The squares add up to 2,000, and √(2,000 ÷ 4) ≈ 22 ms.

How long to record

So far we used five gaps. Real recordings use many more, and the length matters.

In research, the usual standard for a short-term HRV recording is 5 minutes. Anything shorter is called ultra-short-term. 24-hour recordings are the standard for long-term HRV, which is used mostly in medical research.

RMSSD holds up well in short recordings. In a study of 70 healthy adults, RMSSD from just 1 minute, or even 10 seconds, matched the 5-minute value well. SDNN did not. A much larger study of 3,387 adults found the same: a single 10-second ECG gave a valid RMSSD, averaging three 10-second stretches was better, and 2 minutes matched a 4 to 5 minute recording almost perfectly.

SDNN behaves differently because it measures the spread of all the gaps, slow changes included. A longer recording takes in slower rhythms, from posture and activity to the day-night cycle, so SDNN keeps growing with length. Drag the window below from 5 minutes to 24 hours on a simulated day: RMSSD barely moves, SDNN almost triples.

How long should you record?

A simulated day, not a person

RMSSD
37.2 ms
SDNN
29.7 ms
Beats in the window
327

Over 5 min, RMSSD is 37.2 ms and SDNN 29.7 ms. This is the short-term standard.

The slider works when JavaScript is on.

RMSSD and SDNN over windows of 10 seconds to 24 hours of a simulated day, all starting at 7:00. RMSSD settles within a minute or two; SDNN keeps growing because longer windows contain slower rhythms. The Task Force rule follows: measures from recordings of different lengths are not comparable.

A chart of RMSSD and SDNN against recording length on a logarithmic axis from 10 seconds to 24 hours. The RMSSD line stays close to 37 ms at every length. The SDNN line sits near 30 ms up to a few minutes and climbs to about 84 ms at 24 hours. Dashed marks show the minimum lengths: 1 minute for the HF band, 2 minutes for LF, 5 minutes for the short-term standard and the VLF band, 20 minutes for DFA alpha 2, and 24 hours for ULF and long-term SDNN. A slider picks the window length, and readouts give RMSSD, SDNN and the number of beats in the window.

Each measure needs a minimum length:

MeasureShortest useful recordingSource
RMSSD10 seconds to 1 minute; longer is steadierMunoz 2015; Nussinovitch 2011
SDNNAt least 30 seconds, and only comparable at the same lengthMunoz 2015; Shaffer and Ginsberg 2017
Long-term SDNN24 hoursShaffer and Ginsberg 2017

Measures that split HRV into slow and fast rhythms need longer recordings, and sources differ on how much longer. Lesson 18 sets out the rules and where they disagree.

Numbers from recordings of different lengths should not be compared. A 24-hour SDNN carries information about heart risk that a 5-minute SDNN does not (Shaffer and Ginsberg, 2017).

Rings and watches that measure while you sleep each pick their own recording windows and their own way of combining them. That is another reason their numbers differ, which lesson 8 covers.

Where errors creep in

The problems below show up at step 1 or step 3:

  • Movement. It adds noise to both ECG and PPG, and hurts PPG most.
  • Poor contact. A loose strap or electrode, or a ring that slips, can miss beats.
  • Extra beats. If cleaning misses them, RMSSD shoots up.
  • Sensor type. Optical sensors measure the pulse, not the electrical beat, so they drift further from the ECG during activity.

If you want to compare devices, read is wrist HRV as accurate as a chest strap. For the bigger picture on methods and devices, see how to measure HRV.

That completes Level 1. In the next lesson, RMSSD, SDNN and lnRMSSD, you will compare the main HRV measures and learn which one your app likely shows.

All HRV parameters

Try this

Use these six gaps between beats: 900, 950, 880, 940, 910 and 930 ms. Work out RMSSD on paper using the four steps in this lesson. (Answer: about 50 ms. The differences are +50, −70, +60, −30 and +20.)

Check your understanding

Get 3 of 5 right (60%) to pass and tick off this lesson. You can try as often as you like; the options are shuffled each time and your best score is kept.

The questions below are readable without JavaScript. Checking your answers needs JavaScript.

Question 1 What does the optical sensor on the back of a watch or ring actually detect?
Question 2 Why do apps remove some beats before they calculate HRV?
Question 3 The differences between neighbouring gaps are +10, −20 and +10 ms. What is RMSSD?
Question 4 What is the standard length of a short HRV recording in research?
Question 5 A phone camera records 25 pictures a second. What does that do to RMSSD if nothing corrects for it?

  1. Level 1 badge: 0 of 5 lessons
  2. Level 2 badge: 0 of 5 lessons
  3. Level 3 badge: 0 of 5 lessons
  4. Level 4 badge: 0 of 5 lessons
0 of 20 lessons · Now on level 1 of 4 How you get the certificate
Course map

Sources

  1. Publication guidelines for human heart rate and heart rate variability studies in psychophysiology—Part 1: Physiological underpinnings and foundations of measurement Psychophysiology, 2024
  2. Impact of Using Different Levels of Threshold-Based Artefact Correction on the Quantification of Heart Rate Variability in Three Independent Human Cohorts Journal of Clinical Medicine, 2020
  3. Heart rate variability and cardiac vagal tone in psychophysiological research: recommendations for experiment planning, data analysis, and data reporting Frontiers in Psychology, 2017
  4. Heart rate variability: standards of measurement, physiological interpretation and clinical use Circulation (Task Force of the European Society of Cardiology and the North American Society of Pacing and Electrophysiology), 1996
  5. An Overview of Heart Rate Variability Metrics and Norms Frontiers in Public Health, 2017
  6. Role of editing of R–R intervals in the analysis of heart rate variability Frontiers in Physiology, 2012
  7. How accurate is pulse rate variability as an estimate of heart rate variability? A review on studies comparing photoplethysmographic technology with an electrocardiogram International Journal of Cardiology, 2013
  8. Reliability of Ultra-Short ECG Indices for Heart Rate Variability Annals of Noninvasive Electrocardiology, 2011
  9. Validity of (Ultra-)Short Recordings for Heart Rate Variability Measurements PLOS ONE, 2015