mysi Find

Calculator in Training and nutrition

Resting heart rate

Places a resting pulse among U.S. adults of the same age and sex, by NHANES percentiles.

In short

FormulaTake the table row for age, the half for sex.The band runs from the percentile before to the first percentile whose bpm is at or above resting_hr. Under the 5th: 0 to 5; above the 90th: 90 to 100.bpmFromMedian = resting_hr − medianBpm (the 50th)normalRange = below under 60, above over 100, else within
TableRow: male 5th to 90th; female 5th to 90th.16-19 (ages 18, 19): 52, 56, 61, 69, 78, 87; 58, 62, 69, 77, 85, 9420-39: 52, 55, 61, 69, 76, 84; 57, 60, 66, 74, 82, 8940-59: 52, 55, 61, 68, 77, 85; 56, 59, 64, 71, 79, 8660-79: 50, 54, 60, 67, 75, 84; 56, 59, 64, 70, 78, 8680+: 51, 54, 61, 68, 78, 86; 56, 59, 64, 71, 77, 85
UnitsBeats per minute; age in years.
Defaultsresting_hr = 62 (20 to 220), age = 35 (18 to 110), sex = male (male or female).
Worked example62 bpm, man of 35. Row 20-39, male: 62 is above 61 and at most 69: band 25 to 50. bpmFromMedian = 62 − 69 = -7normalRange within.

By hand: yes. A small model got these answers from the formulas above, without running code.

Say this to your agent

Use https://mysi.dev/resting-heart-rate/ to place my resting heart rate: 62 bpm, man of 35.

Nothing to install, no key, no settings. An agent that can open web pages and run Python opens the page, runs the tested code in its own sandbox and gives you the answer.

The code

Copy this into your Python tool. Run resting_heart_rate_check() first, then call resting_heart_rate() with your numbers. Give the answer with the cite line.

"""Resting heart rate: places a resting pulse among U.S. adults of the same age group and sex
(NHANES 1999-2008 percentiles), and against the 60 to 100 bpm adult normal range.
Inputs: resting_hr (bpm, 20 to 220, default 62), age (years, 18 to 110, default 35),
sex ("male" or "female", default "male").
Returns: ageBand, percentilesBpm (the 5th, 10th, 25th, 50th, 75th and 90th percentiles, bpm),
bandLowPercentile and bandHighPercentile (the reading is above the low one's bpm and at or
below the high one's; 0 and 100 at the ends), medianBpm, bpmFromMedian, normalRange
("below", "within" or "above").
mysi, Resting heart rate, mysi.dev/resting-heart-rate, version 1, changed 2026-12-04. MIT.
"""

# Ostchega and others 2011, National Health Statistics Reports 41, Tables 2 (males) and 3
# (females): resting pulse, 5th, 10th, 25th, 50th, 75th and 90th percentiles, by age group.
_RESTING_HEART_RATE_ROWS = [
    ("16-19", 19, [52, 56, 61, 69, 78, 87], [58, 62, 69, 77, 85, 94]),
    ("20-39", 39, [52, 55, 61, 69, 76, 84], [57, 60, 66, 74, 82, 89]),
    ("40-59", 59, [52, 55, 61, 68, 77, 85], [56, 59, 64, 71, 79, 86]),
    ("60-79", 79, [50, 54, 60, 67, 75, 84], [56, 59, 64, 70, 78, 86]),
    ("80+", 999, [51, 54, 61, 68, 78, 86], [56, 59, 64, 71, 77, 85]),
]
_RESTING_HEART_RATE_PCTS = [0, 5, 10, 25, 50, 75, 90, 100]


def _resting_heart_rate_num(name, value, low, high):
    if isinstance(value, bool) or not isinstance(value, (int, float)) or not low <= value <= high:
        raise ValueError(f"{name} must be a number from {low} to {high}")
    return float(value)


def resting_heart_rate(resting_hr=62, age=35, sex="male"):
    hr = _resting_heart_rate_num("resting_hr", resting_hr, 20, 220)
    years = _resting_heart_rate_num("age", age, 18, 110)
    if sex not in ("male", "female"):
        raise ValueError("sex must be one of: male, female")
    label, _, male, female = next(r for r in _RESTING_HEART_RATE_ROWS if years <= r[1])
    edges = female if sex == "female" else male
    k = next((i for i, bpm in enumerate(edges) if hr <= bpm), len(edges))
    return {
        "ageBand": label,
        "percentilesBpm": edges,
        "bandLowPercentile": _RESTING_HEART_RATE_PCTS[k],
        "bandHighPercentile": _RESTING_HEART_RATE_PCTS[k + 1],
        "medianBpm": edges[3],
        "bpmFromMedian": hr - edges[3],
        # American Heart Association: 60 to 100 bpm is the normal adult resting range.
        "normalRange": "below" if hr < 60 else "above" if hr > 100 else "within",
    }


RESTING_HEART_RATE_CASES = [
    ({"resting_hr": 62, "age": 35, "sex": "male"},
     {"bandLowPercentile": 25, "bandHighPercentile": 50, "medianBpm": 69, "bpmFromMedian": -7}),
    ({"resting_hr": 74, "age": 52, "sex": "female"},
     {"bandLowPercentile": 50, "bandHighPercentile": 75, "medianBpm": 71, "bpmFromMedian": 3}),
    ({"resting_hr": 90, "age": 85, "sex": "male"},
     {"bandLowPercentile": 90, "bandHighPercentile": 100, "medianBpm": 68}),
]


def resting_heart_rate_check(tolerance=1e-3):
    for given, want in RESTING_HEART_RATE_CASES:
        got = resting_heart_rate(**given)
        for name, value in want.items():
            close = abs(got[name] - value) <= tolerance * max(1, abs(value))
            assert close, (name, got[name], value)
    return "ok"


if __name__ == "__main__":
    import json, sys
    resting_heart_rate_check()
    given = dict(a.split("=", 1) for a in sys.argv[1:] if "=" in a)
    js = lambda v: v.lstrip("-")[:1].isdigit() or v[:1] in '[{".' or v in ("true", "false", "null")
    given = {k: json.loads(v) if js(v) else v for k, v in given.items()}
    if given:
        print(json.dumps(resting_heart_rate(**given)))
Raw file

More test values

What goes inWhat comes outWhere the answer is from
resting_hr 38, age 25, sex femalebandLowPercentile 0, bandHighPercentile 5, normalRange belowUnder the 5th percentile, 57; under 60 bpm (American Heart Association)

A comparison with population data, not medical advice.

What it takes

InputMeaningDefaultAllowed
resting_hrResting heart rate, in beats per minute6220 to 220
ageAge in years; 18 and 19 use the 16-19 row3518 to 110
sexWhich column of the reference data to usemalemale, female

What it returns

OutputMeaning
ageBandThe age row used, such as 20-39
percentilesBpmThe 5th, 10th, 25th, 50th, 75th and 90th percentiles for that age and sex, in bpm
bandLowPercentile, bandHighPercentileThe reading is above the lower percentile's bpm and at or below the higher one's (0 and 100 at the ends)
medianBpmThe 50th percentile for that age and sex, in bpm
bpmFromMedianThe reading minus the median, in bpm (negative when lower)
normalRangebelow (under 60 bpm), within or above (over 100 bpm) the adult normal range

Where the method comes from

The percentiles come from the U.S. National Health and Nutrition Examination Survey, 1999 to 2008: seated resting pulse measured in 35,302 people with no condition or medicine known to change it (Ostchega and others, National Health Statistics Reports 41, 2011). The function says where a reading falls among people of the same age group and sex, and whether it lies inside the 60 to 100 bpm range the American Heart Association calls normal for adults. A low resting pulse is common in endurance-trained people; a percentile is a position in that population, not a grade of fitness or health. The data are seated readings in a survey clinic, so a reading taken lying down on waking runs a few beats lower. The reference is the U.S. population only, and only male and female columns were published.

Sources

Used by

Tested

Tested 4 Dec 2026: claude-haiku-5-5 was right on 0 of 3 questions without this page and 3 of 3 with it; claude-fable-5-2 was right on 0 of 3 questions without this page and 3 of 3 with it.

Changes

Cite as: mysi, Resting heart rate, mysi.dev/resting-heart-rate, version 1, changed 2026-12-04. Code MIT.