Skip to main content
v2026.11,986 entries · CC-BY 4.0

WFDB: Waveform Database Format, Header Fields and Software

What WFDB is: PhysioNet’s waveform format and software, how a record’s header and signal files are laid out, and what to report so analyses reproduce.

Written and maintained by CASRAI Editorial Board

Published

On this page

WFDB (the Waveform Database format) is the file format and software family that PhysioNet uses to store digitised physiological signals, such as ECG, together with their annotations. A WFDB record is a set of files: a plain-text header (.hea) that describes the signals, one or more binary signal files, and optional annotation files. “WFDB” is also the name of the original C library and command-line toolkit (the WFDB Software Package) and of ports such as wfdb-python.

What WFDB means: a format, a software package and language ports

People use the word for three related but different things, and mixing them up causes most confusion when a paper says “processed with WFDB”.

The format specification

The format is defined in the WFDB Applications Guide on PhysioNet, in separate manual pages for the header file, the signal file formats and the annotation file formats. The header page describes a header as line- and field-oriented ASCII text that names the signal files belonging to a record and gives their attributes. The signal and annotation pages describe the binary layouts. Because the specification is public and the files are plain text plus documented binary, any programme can read a record without the original software.

The WFDB Software Package

The reference implementation is the WFDB Software Package on PhysioNet. Version 10.7.0 was published on 20 June 2022 (the previous release, 10.6.2, was published on 26 March 2021), by George Moody, Tom Pollard and Benjamin Moody, under the GNU General Public License version 3. It consists of a C library and more than 70 command-line applications, with a Programmer’s Guide and an Applications Guide. It is written to be portable across GNU/Linux, macOS, Windows and other Unix systems, and it can read records from a web server such as PhysioNet itself through libcurl. The FLAC-compressed signal formats (508, 516 and 524) need the libFLAC library.

Language ports, including wfdb-python

The software page notes ports to MATLAB and Python. The best-known Python one is the wfdb package, described in its documentation as a native Python waveform-database package for reading, writing and processing WFDB signals and annotations. Its documentation states that it was built to follow the original WFDB package specifications, and it lists copyright to the MIT Laboratory for Computational Physiology. The documentation reviewed here covers version 4.3.1 and organises the library into input/output modules (records, annotations, archives, cloud access and downloads), plotting, and processing modules for heart rate, peak detection, filters, QRS detectors and annotation evaluators. It also documents conversions between WFDB and CSV, EDF, MATLAB, TFF and WAV formats.

How a WFDB record is stored

A record is identified by a record name, which may contain only letters, digits and underscores. The header file carries that name and points to everything else, so the header is the one file you cannot lose. The signal samples live in separate binary files, and several signals can share one file (the specification calls this a signal group, with samples from the signals stored alternately). Annotations, such as beat labels, are stored in their own files.

Signal files

Signal data comes in a small number of numbered storage formats. The most common are format 8 (8-bit first differences) and format 16 (16-bit amplitudes). The signal page states that most signal files in PhysioBank are written in format 212, which stores each sample as a 12-bit two’s-complement value, packing two samples into three bytes. The full list of format codes, with the bits per sample and how each is packed, is in the dataset table on this page.

One practical consequence is that format 8 stores only the difference between successive samples. The specification warns that when a difference cannot fit in 8 bits it is clipped to the largest difference of the appropriate sign, so converting a signal from another format into format 8 can lose information. Format 8 also computes differences within each signal, not across the multiplexed file, so signals whose baselines differ widely can still be stored.

Annotation files

The annotation page defines two binary layouts that WFDB library applications can tell apart automatically. The preferred MIT format is compact, averaging slightly over two bytes per annotation: in each two-byte pair, the six most significant bits hold the annotation type code and the remaining ten bits hold the time since the previous annotation, in sample intervals. The alternative AHA format uses 16 bytes per annotation and is described as normally used only to exchange files between institutions on 9-track tape. The page credits the original MIT annotation format to Paul Schluter and the AHA format to Russ Hermes.

Reading a header file line by line

The header page includes a worked example from the MIT-BIH Arrhythmia Database, record 100. The text of the two signal lines and the record line is:

100 2 360 650000 0:0:0 0/0/0
100.dat 212 200 11 1024 995 -22131 0 MLII
100.dat 212 200 11 1024 1011 20052 0 V5

The header page explains the fields from left to right, which lets you decode every value.

The record line

  • 100 is the record name. A number of segments, if present, follows a slash directly after the name; here it is absent, so this is an ordinary one-segment record.
  • 2 is the number of signals. The specification notes this is not necessarily the number of signal files, because signals can share a file.
  • 360 is the sampling frequency in samples per second per signal. If the field is missing, a value of 250 is assumed.
  • 650000 is the number of samples per signal. At 360 samples per second this is slightly over 30 minutes, as the page itself says. If it is zero or missing, the length is unspecified and checksum verification is disabled.
  • 0:0:0 0/0/0 are the base time and base date. The page says these were not recorded for this record and the defaults are shown.

A signal line

  • 100.dat is the signal file name. Both signals use the same file, so the two lines name the same file.
  • 212 is the storage format: 12-bit packed samples.
  • 200 is the ADC gain in ADC units per physical unit. The physical unit defaults to one millivolt when the units field is absent. A missing or zero gain means the signal is uncalibrated, and 200 may be assumed.
  • 11 is the ADC resolution in bits.
  • 1024 is the ADC zero, the sample value for an input exactly in the middle of the converter’s range. The baseline (the sample value that corresponds to 0 physical units) is not written, so it equals the ADC zero.
  • 995 and 1011 are the initial values, the values of sample 0 in each signal.
  • -22131 and 20052 are the 16-bit signed checksums of all 650,000 samples of each signal.
  • 0 is the block size, usually zero, meaning reads can use any block size.
  • MLII and V5 are the signal descriptions, naming the leads. The header page expands MLII as modified lead II.

The lines that begin with # after the last signal line are info strings, free text that the specification says varies between databases and should not be relied on.

Turning a stored value into a physical value

The specification defines gain as ADC units per physical unit and baseline as the sample value for 0 physical units. For the record above, with gain 200 ADC units per millivolt and baseline 1024, the first sample of the first signal is 995. The arithmetic is (995 – 1024) / 200 = -0.145 mV, and for the second signal (1011 – 1024) / 200 = -0.065 mV. This is the page’s remark that both signals “began slightly below 0” expressed as numbers. This is an illustration of the stated definitions, not a rule about any other record, because other headers carry different gains, baselines and units.

The same arithmetic gives the file size of record 100’s signal file: two signals of 650,000 samples each is 1,300,000 samples, and format 212 stores two samples in three bytes, so the data portion is 1,950,000 bytes.

Multi-segment records and optional modifiers

A record line that includes a slash and a segment count makes a multi-segment record, whose top-level header has segment lines instead of signal lines. Segments are themselves ordinary one-segment records, and the signals can be read as if continuous. The specification defines two types. In a fixed-layout record the arrangement of signals, gains, baselines, units, ADC resolution, zero and descriptions match across all segments, though segments may use different storage formats. In a variable-layout record, a layout segment (segment 0, zero samples long, with signal file names written as ~) sets the desired arrangement, and signals are rearranged and rescaled to it when read with WFDB library version 10.3.17 or later. A null segment is marked with ~ as the record name and its samples read as WFDB_INVALID_DATA.

Some signal-line fields attach to the format field with a separator: x for samples per frame (a signal sampled at an integer multiple of the base frequency), : for skew (samples of a signal considered to precede sample 0) and + for a byte offset (a preamble in a signal file written by other software). The specification says the WFDB library cannot write byte offsets, so they are inserted into headers manually.

Which implementation to use: the C package or wfdb-python

The sources support the following distinctions between the two.

  • The C WFDB Software Package is the reference: a C library plus more than 70 command-line applications, GPL v3, with the Programmer’s and Applications Guides.
  • wfdb-python follows the original specifications and offers a Python interface for records, annotations, downloads from PhysioNet, plotting and signal-processing helpers.
  • Because wfdb-python is built to the same specifications, both work from the same header, signal and annotation layouts.

Choose by workflow: a pipeline built in Python generally wants the Python package, while shell-based batch conversion suits the command-line applications. Neither source ranks them, so treat this as an editorial rule of thumb, not a recommendation from PhysioNet.

A reproducibility checklist for papers and datasets that use WFDB

Because the format has several layers, a methods section is only reproducible if it states which layer was used. The PhysioNet package page gives a preferred citation: Moody G, Pollard T, Moody B (2022) WFDB Software Package v10.7.0, PhysioNet, RRID:SCR_007345, DOI 10.13026/gjvw-1m31. From that and the header specification, these items are worth recording. See also computational reproducibility for the wider idea.

  • Software and version: the C package version, or the wfdb-python version, and the date of any download, with the package DOI and RRID where you used the C package.
  • Record identifiers: record names and the database they come from, plus the dataset version where the database is versioned (see versioning research datasets).
  • Sampling frequency: whether it was read from the header or assumed; the default is 250 samples per second only when the field is missing.
  • Gain, baseline and units: whether you analysed raw ADC values or physical values, and whether the units field was present (millivolts is the assumed unit when it is absent).
  • Storage format code: useful when you convert between formats, since format 8 conversions can lose information.
  • Checksum verification: the header checksum is verified only when the whole record is read without skipping and the sample count is specified, so say whether the check could apply.
  • Annotation source: which annotation file and annotator you used, because annotation files are separate from the signals.
  • Segments: for multi-segment records, whether segments were joined, and how null segments (invalid data) were handled.

Where WFDB shows up in research practice

PhysioNet hosts many waveform and clinical datasets, and several of them are covered elsewhere on this site. Datasets with restricted access are obtained through PhysioNet’s credentialing process, described in PhysioNet credentialed access, and a large PhysioNet-hosted clinical database is explained in MIMIC-IV. For signal quality, a typical analysis problem is explained in ECG baseline wander. WFDB is a way of storing signals, so it matters mainly where those signals are shared, cited or reanalysed, and it is part of how a dataset’s metadata format is made explicit.

Common misunderstandings

“WFDB is a database”

The name suggests a single database, but it is a format and a toolkit. The databases are separate collections, such as the MIT-BIH Arrhythmia Database whose record 100 is used above, that are distributed in WFDB format.

“The .dat file is the record”

A signal file without its header cannot be interpreted: the header supplies the sampling frequency, the number of signals, the storage format, gain, baseline and units. Keep the header with the signal files, and keep annotation files with them if you need labels.

“The numbers in the file are millivolts”

Samples are stored as ADC units. They become physical values only through the gain, baseline and units in the header, and the unit is only assumed to be millivolts if the units field is absent.

“All WFDB files use the same sample format”

The header names a storage format per signal group, and records can use different formats. Even segments of one multi-segment record can use different formats.

“The header always carries clinical details”

Info strings after the signal lines are optional, and their content and format vary between databases, so analysis code should not depend on a particular info string being present.

“A newer wfdb-python equals a newer format”

The wfdb-python documentation says the package follows the original specifications. A package version number tells you about software behaviour, not a different file format.

Frequently asked questions

What does WFDB stand for?

WFDB stands for waveform database. The wfdb-python documentation describes its package as a native Python waveform-database (WFDB) package for reading, writing and processing WFDB signals and annotations.

Who maintains the WFDB Software Package?

The PhysioNet page for version 10.7.0 lists the authors as George Moody, Tom Pollard and Benjamin Moody, and gives the GNU General Public License version 3 as the licence.

What is in a WFDB record?

A header file describing the signals, one or more signal files holding the samples, and optionally annotation files. Multi-segment records add a top-level header that points to ordinary records as segments.

Which signal format code is most common?

The signal-format page states that most of the signal files in PhysioBank are written in format 212, the 12-bit packed format.

Sources

Data: WFDB signal file storage formats: sample representation and packing by format code

Compiled from the WFDB Applications Guide signal(5) manual page on PhysioNet. For each format code it gives how a sample is represented, the bits per sample, and the packing or byte-order notes the page states.

WFDB signal file storage formats: sample representation and packing by format code
Format codeSample representationBits per sample (bits)Packing and notes
88-bit first difference; sample n = initial value plus the sum of the first n differences8Single bytes; out-of-range differences clipped to -128 or +127, so conversion into this format can lose information
1616-bit two's-complement amplitude16Least significant byte first; unused high bits sign-extended
2424-bit two's-complement amplitude24Least significant byte first
3232-bit two's-complement amplitude32Least significant byte first
6116-bit two's-complement amplitude16Most significant byte first
808-bit offset binary amplitude8Subtract 128 from each unsigned byte to get a signed value
16016-bit offset binary amplitude16Subtract 32,768 from each unsigned byte pair; least significant byte first
21212-bit two's-complement amplitude, bit-packed12Two samples in three bytes; the format used by most PhysioBank signal files
31010-bit two's-complement amplitude, bit-packed10Three samples per two byte pairs; the low bit of each of the first two pairs is discarded
31110-bit two's-complement amplitude, bit-packed10Three samples packed into a little-endian 32-bit integer; the top two bits are unused
508, 516, 524FLAC-compressed signals at 8, 16 or 24 bits per sample8, 16 or 24At most eight signals per file; all signals share one sampling frequency; needs libFLAC

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about WFDB: Waveform Database Format, Header Fields and Software

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →