Introduction
HDF5 stores large amounts of numerical data, such as measurements, simulation output and images, organised like a file system inside one file. It began at the National Center for Supercomputing Applications and is now maintained by The HDF Group. HDF5 appeared in 1998 as a redesign of the earlier HDF4, and the two formats are not compatible.
Several other formats are HDF5 underneath: NetCDF-4
climate data, MATLAB’s version 7.3 .mat
files and the .h5 model files saved by Keras. Files use .h5 or
.hdf5, and sometimes .hdf.
Structure
An HDF5 file holds groups, which work like folders, and datasets, which are arrays of any number of dimensions with a data type such as 32-bit float. Both can carry named attributes for metadata. Datasets can be stored whole or in chunks, and chunks can be compressed.
The file starts with an 8-byte signature, 89 48 44 46 0D 0A 1A 0A
(\211HDF\r\n\032\n). It can also sit at byte 512, 1024, 2048 or any later
power of two, leaving room for a user block before it. The
superblock follows the signature: its version, the sizes used for
offsets and lengths in this file, and the address of the root group. Every other object
is found by following addresses from there.
0User block optional, any size that is a power of two from 512optional…Signature and superblock versions, sizes, root group addressvaries…Objects group and dataset headers, B-trees, heaps and data chunksvaries
The superblock and object headers and messages, types and storage pages give the structures and codes.
In the explorer
Drop an .h5 or .hdf5 file on this site. The structure tree lays the
file out by address: the superblock (versions 0 to 3, each field named, the version 2 and 3
checksum verified), every object header, version 1 and 2, with each message decoded
(dataspace, datatype with all its classes, data layout, filter pipeline, fill value, links,
attributes, symbol table, continuation, modification time and the rest), the group B-tree
nodes, symbol table nodes and local heaps of old-style groups, the chunks and the raw data of
datasets, fractal heaps with their blocks, version 2 B-trees, fixed and extensible array chunk
indexes, free-space managers, the shared message table, the driver information block (each
drawn field by field), and the bytes between them labelled. Dense links and attributes, the
Virtual mappings and the Free space tables are listed. The Objects table lists every group, dataset and
named datatype with its path, datatype, shape, layout and filters; the Attributes and Links
tables list those, with attribute values decoded. The options bar chooses a dataset, and the
Values table lists every value of it, a page at a time, read through its layout (compact,
contiguous or chunked) and its deflate, shuffle, Fletcher-32, N-bit, scale-offset and Szip filters. Damaged structures, wrong
checksums and cut files are reported, and the rest of the file is still shown.
Not described
The pages follow the HDF5 File Format Specification version 3.0. The bit-field descriptions of datatype classes 6 to 10 and the Appendix D encodings were compared with the specification source on 2026-11-13 and match.
Known, not yet covered
- Reference: the layouts of filters whose IDs the specification does not define (third-party filters), which are in their own projects' documents.
- Viewer, closed on 2026-11-14: dense links and attributes (a fractal heap,
FRHP, with its direct and indirect blocks, managed, tiny and huge objects, indexed by version 2 B-treesBTHD,BTINandBTLFof types 1 to 11), chunked datasets through the fixed array (FAHD, paged or not), the extensible array (EAHD) and the version 2 B-tree chunk indexes (types 10 and 11) as well as the version 1 B-tree, single-chunk and implicit indexes, the Fletcher-32 checksum (verified, including the byte order of libraries before 1.6.3), the driver information block (multi and family drivers), free-space managers with their section lists, the shared message table with messages in the shared heap and committed messages, and virtual dataset mappings (every selection type) are all read, and every structure is drawn field by field. Specification text read on 2026-11-14. The fixed and extensible array element numbering, the paged layouts and the block sizes were checked on 2026-11-14 against the library source (H5FA*.c,H5EA*.c,H5Dfarray.c,H5Dearray.c,H5VM.c, release 2.2.0) and one error was corrected: the page bitmap of an extensible array secondary block is a byte-rounded mask for each data block, not one mask for the block (see the structures page). - Viewer: the values of a virtual dataset are not in the file: they live in the source datasets named in the mappings (usually other files), which a viewer of one file does not have. The mappings are shown in full (the source file, the source dataset, the source selection and the virtual selection of each, every selection type), and the dataset’s values are labelled as being in those source files.
- Viewer, filters: deflate, shuffle, Fletcher-32, N-bit (ID 5), scale-offset (ID 6) and Szip (ID 4) are decoded, the last three from the library source and the CCSDS 121.0-B-3 standard (described here), with these limits: a scale-offset chunk whose values are stored at full width is read as little-endian written; a floating-point scale-offset value is computed as the library does, in the float type, and was checked by hand-worked vectors only; the szip decoder implements the basic option set libaec uses for the HDF5 interface (not the restricted set, signed samples or the 3-byte packing, which the HDF5 interface does not select). No file written by the HDF5 library was available, so these were tested against streams built here from the algorithms. Filters outside the specification (third-party, IDs 256 and above) are defined by their own code and are shown as stored.
- Viewer: the chunks of filtered datasets are not decoded when the file is opened (that would take too long for a large file). A chunk is decoded when the values of its dataset are read; a filter error or a wrong Fletcher-32 checksum found then joins the Problems list, marked as found when that dataset was opened, and the Overview’s counts do not change.
- Viewer: the global heap (variable-length data, read when a value needs it, and the virtual dataset mappings) is not drawn as a structure of its own: its bytes are shown as space the viewer did not follow.
- Viewer: the viewer was written and tested with files built from this specification (no file written by the HDF5 library was available), so a feature of a real file that the pages describe differently would show as an issue; the Objects table lists at most 20,000 objects.
Also used for
- Hierarchical Data Format version 4 – The older HDF: tagged objects found through data descriptor blocks.
- Keras model (legacy HDF5) – A whole Keras model: JSON config and HDF5 weights in a ZIP archive.
Links
Software
Developers
- The HDF5 library and tools – the reference library, with
h5dumpandh5ls(C) - h5py – HDF5 files as NumPy arrays (Python)
- PyTables – tables and arrays stored in HDF5 (Python)
Reference
- HDF5 File Format Specification – The HDF Group’s description of the file layout