Heart rate variability (HRV) is calculated by measuring the time between consecutive heartbeats (RR or NN intervals), then applying statistical or spectral math to that series of intervals. Time-domain methods compute standard deviations and mean differences of successive beats. Frequency-domain methods use Fourier or autoregressive transforms to split variability into bands. The result is expressed in milliseconds, a unitless ratio, or a normalized percentage.

The number your watch reports is not a direct measurement. It is a derived statistic computed from a chain of decisions: which beats are detected, which are excluded, how long the recording runs, and which formula the software applies. Change any link and the output changes, even if your heart behaved identically. That is why two devices can disagree on the same night and both be technically correct.

This explainer walks through the actual arithmetic, the thresholds professionals use, and the places where consumer algorithms quietly diverge from clinical standards.

The RR interval as the raw signal

Every HRV calculation begins with beat detection. An ECG or optical sensor identifies each R-wave peak, and the device timestamps them. The gap between two peaks is an RR interval, measured in milliseconds. At a resting heart rate of 60 beats per minute, the average RR interval is 1,000 ms. At 75 bpm it is 800 ms.

The intervals are then filtered. Beats that follow an ectopic event (a premature contraction) or fall outside a plausibility window are usually marked as artifacts and removed. Clinical software often discards a beat if its interval deviates more than 20 percent from the local average, a common artifact threshold in Holter analysis. Consumer devices use proprietary rules that are rarely published.

Filtering matters because a single missed or doubled beat can distort the statistics dramatically. A dropped beat roughly doubles one interval; the algorithm may read that as a huge surge in variability. The cleaned series is called the NN interval series, where NN means "normal-to-normal." Everything downstream operates on that corrected series, so the artifact policy is arguably the most consequential choice in the entire pipeline.

Time-domain formulas, beat by beat

Time-domain metrics are simple arithmetic on the NN series, which is why they dominate consumer wearables.

SDNN is the standard deviation of all NN intervals in the recording window. It captures total variability from all sources, slow and fast. RMSSD is the root mean square of successive differences: square each beat-to-beat change, average those squares, take the square root. Because it operates on differences between adjacent beats, RMSSD reflects fast, beat-to-beat fluctuations and is the preferred surrogate for vagal (parasympathetic) tone.

pNN50 is the percentage of successive intervals that differ by more than 50 ms. It is conceptually similar to RMSSD but coarser, since it counts a threshold crossing rather than measuring magnitude. SDANN, used mainly in 24-hour recordings, is the standard deviation of the averages of five-minute segments and reflects slower circadian trends.

Here is the counterintuitive part: RMSSD and SDNN can move in opposite directions. During deep slow breathing at about six breaths per minute, respiratory sinus arrhythmia inflates beat-to-beat differences, pushing RMSSD up, while the overall spread of intervals may barely change. A single "HRV" figure that does not name its metric is therefore ambiguous by construction.

Frequency-domain decomposition and why window length matters

Frequency-domain analysis treats the NN series as a signal and estimates how much variance sits in each band. The standard bands, defined in the 1996 Task Force consensus, are high frequency (0.15 to 0.40 Hz), low frequency (0.04 to 0.15 Hz), and very low frequency (0.0033 to 0.04 Hz). High-frequency power tracks respiration and vagal activity. Low-frequency power is a mixed signal reflecting both baroreflex and sympathetic influences, which is why interpreting the LF/HF ratio as "sympathetic balance" is contested.

The transform requires stationarity, meaning the statistical properties of the signal should not drift during the window. This is why short-term recordings use five minutes and why a ten-second wearable reading cannot produce a legitimate frequency-domain result: the lowest resolvable frequency is the inverse of the window length. A 300-second window resolves down to 0.0033 Hz; a 30-second window cannot resolve anything below roughly 0.033 Hz.

Detrending, windowing, and interpolation choices all shift the output. A study comparing software packages on identical ECG data has repeatedly found band-power differences large enough to change a clinical interpretation. The math is standard. The implementation is not.

Method Input requirement Primary output Typical use
SDNN 5-min to 24-h NN series Total variability (ms) Research, Holter
RMSSD 1-min to 5-min NN series Vagal surrogate (ms) Consumer wearables
pNN50 2-min to 5-min NN series Vagal surrogate (%) Legacy clinical
HF power 5-min minimum Parasympathetic (ms²) Autonomic research
LF/HF ratio 5-min minimum Mixed, contested Research only
SDANN 24-h recording Circadian trend (ms) Cardiolog risk workup

Timeline: how long a calculation needs

Recording length What is computable Key limitation
10 seconds Instantaneous rate only Too short for any HRV metric
30 seconds Crude RMSSD Unstable; high error
1 minute RMSSD, pNN50 No frequency domain
5 minutes Full short-term set Standard clinical short epoch
1 hour Time domain plus trends Circadian drift begins
24 hours All metrics, SDANN Requires artifact-free ECG
7+ days Personal baseline Not a single-session metric

The five-minute mark is not arbitrary. It is the shortest window that reliably supports frequency-domain estimation under the Task Force framework, and shorter windows inflate error in RMSSD as well.

Where consumer algorithms diverge from clinical ones

Wearables rarely compute SDNN over five minutes and rarely publish their artifact rules. Many optical sensors sample at 25 to 1,000 Hz, and some derive RR intervals from a smoothed pulse wave rather than a true electrical signal, which blunts fast fluctuations and systematically lowers RMSSD. Validation studies against ECG commonly report small but consistent biases that vary by device, posture, and skin perfusion.

The professional caveat: a wearable HRV value is best treated as a personal index, not a clinical measurement. Comparing your RMSSD to a published population table assumes both were computed the same way, which is often false. Comparing your own value to your own rolling baseline cancels most of that bias, because the algorithm is held constant.

Red flags that should stop you from trusting a reading:

A single night's value used to make a training or health decision. HRV reported during or immediately after exercise, when the signal is non-stationary. Any value derived from fewer than 50 clean beats. Readings taken within 30 minutes of caffeine, alcohol, or a large meal. Devices that display one "HRV score" without naming the underlying metric.

Applying HRV numbers without fooling yourself

Practical use rests on three habits. First, standardize the conditions: measure at the same time each morning, ideally after waking and before standing, for the same duration. Second, build a baseline over at least 14 days before interpreting anything. Third, act on trends, not points, using the smallest worthwhile change rather than a fixed cutoff.

A defensible personal rule: treat a drop of more than one standard deviation below your 7-day rolling mean as a signal to reduce training load or prioritize sleep. Treat a sustained rise of similar magnitude, without a change in training, as worth noting rather than celebrating, since unusually high variability can accompany fatigue in some people.

For researchers, reconcile thresholds explicitly. The Task Force five-minute epoch, the 20 percent artifact filter, and the 50 ms pNN50 cutoff are consensus conventions, not physiological constants. Pick one standard, state it, and keep it fixed across comparisons. Mixing a 30-second wearable RMSSD against a five-minute clinical SDNN is a category error, not a finding.

What HRV cannot tell you

HRV is a summary of timing, not a diagnosis. It cannot distinguish a healthy high-vagal state from an arrhythmia without beat-level inspection, and it cannot separate sympathetic from parasympathetic drive on its own. The LF/HF ratio in particular has been criticized for overreach; low-frequency power reflects a baroreflex loop with both branches engaged, so labeling it "sympathetic" oversimplifies the physiology.

Age, fitness, posture, breathing rate, and medication all shift the baseline, sometimes by more than the effect you are trying to detect. Normative ranges exist but carry wide confidence intervals, and no major society endorses a single HRV threshold for clinical decision-making in healthy adults. The metric is most defensible as a longitudinal, within-person signal collected under controlled conditions.

If your goal is to know how is HRV calculated so you can interpret your own data, the answer reduces to this: find out which metric your device reports, how long it records, and how it handles artifacts. Those three facts explain most of the variance between devices, and they matter more than any single night's number.