File reference library

File signatures

Browse common file headers and magic-byte patterns by format. Look up byte offsets, hexadecimal values and the details that help distinguish containers from the data they hold.

Find a signature

Search by format name, extension or hexadecimal bytes.

20 of 20 entries

Signature entries

Hexadecimal reference
Images

JPEG image

.jpg · .jpeg

JPEG marker prefix

FF D8 FF
Byte offset
0
Media type
image/jpeg

The first two bytes mark the start of the image. The following marker introduces the next JPEG segment, and wrapper details vary between files.

Library of Congress: JPEG / JFIF
Images

PNG image

.png

Eight-byte PNG signature

89 50 4E 47 0D 0A 1A 0A
Byte offset
0
Media type
image/png

The eight-byte signature is followed by the PNG chunk stream. A valid PNG begins with an IHDR chunk and ends with IEND.

W3C PNG Specification
Images

GIF image

.gif

GIF 87a

47 49 46 38 37 61

ASCII GIF87a

GIF 89a

47 49 46 38 39 61

ASCII GIF89a

Byte offset
0 · 0
Media type
image/gif

The six-byte header identifies the GIF version. Either header is valid; 87a and 89a are version identifiers.

GIF89a Specification
Images

TIFF image

.tif · .tiff

Little-endian

49 49 2A 00

Big-endian

4D 4D 00 2A
Byte offset
0 · 0
Media type
image/tiff

The first two bytes state the byte order. The next two bytes contain the value 42, which identifies classic TIFF. BigTIFF uses a different version marker.

Library of Congress
Images

BMP image

.bmp

Bitmap file type marker

42 4D

ASCII BM

Byte offset
0
Media type
image/bmp

The BM marker identifies a Windows bitmap file header. The header that follows stores the file size and pixel offset, while the bitmap information header stores image dimensions.

Microsoft Learn: BITMAPFILEHEADER
Images

WebP image

.webp

RIFF container marker

52 49 46 46

ASCII RIFF

WebP form type

57 45 42 50

ASCII WEBP

Byte offset
0 · 8
Media type
image/webp

WebP uses a RIFF container. The four bytes between RIFF and WEBP hold the RIFF size, so the two text markers are not adjacent.

RFC 9649: WebP
Images

SVG image

.svg

XML-based text format

No fixed magic-byte signature
Byte offset
Variable
Media type
image/svg+xml

SVG is XML-based. Its root svg element can appear after a byte-order mark, whitespace, comments or an XML declaration, so its opening bytes can vary.

W3C SVG 2
Documents

PDF document

.pdf

PDF header

25 50 44 46

ASCII %PDF

Byte offset
0
Media type
application/pdf

The header is followed by a hyphen and a PDF version identifier. Some readers allow leading bytes, so the header position can vary between files.

Library of Congress
Documents

Open XML Office package

.docx · .xlsx · .pptx

ZIP local-file header

50 4B 03 04
Byte offset
0
Media type
Depends on the document type (DOCX, XLSX or PPTX).

DOCX, XLSX and PPTX use ZIP-based packages. This header identifies the package container, while [Content_Types].xml and the internal parts distinguish the document type.

PRONOM: Office Open XML
Archives

ZIP archive

.zip

Local file header

50 4B 03 04

Empty archive end record

50 4B 05 06
Byte offset
0 · 0
Media type
application/zip

ZIP files can begin with different valid records. The same container is also used by DOCX, XLSX and PPTX packages.

The National Archives: PRONOM
Archives

7-Zip archive

.7z

7z signature header

37 7A BC AF 27 1C
Byte offset
0
Media type
application/x-7z-compressed

The six-byte sequence is the 7z signature. The following header fields include the archive version and checksums.

PRONOM: 7-Zip signature
Archives

RAR archive

.rar

RAR 1.5–4.x

52 61 72 21 1A 07 00

RAR 5 and later

52 61 72 21 1A 07 01 00
Byte offset
0 · 0
Media type
application/vnd.rar

The final version bytes distinguish older RAR archives from the RAR 5 signature.

RAR Technical Notes
Archives

GZIP stream

.gz · .tgz

GZIP header and DEFLATE method

1F 8B 08
Byte offset
0
Media type
application/gzip

The first two bytes identify the GZIP format. The third byte is the compression-method field, commonly 08 for DEFLATE.

RFC 1952: GZIP
Audio

WAVE audio

.wav

RIFF container marker

52 49 46 46

ASCII RIFF

WAVE form type

57 41 56 45

ASCII WAVE

Byte offset
0 · 8
Media type
audio/wav

WAVE is a RIFF-based container. The file size occupies bytes 4–7 between the RIFF marker and WAVE form type.

Library of Congress
Audio

MP3 with ID3v2 tag

.mp3

ID3v2 identifier

49 44 33

ASCII ID3

Byte offset
0 when an ID3v2 tag is present
Media type
audio/mpeg

Some MP3 files begin with an ID3v2 tag. Others start directly with the MPEG audio frame sequence.

ID3v2.4 Structure
Audio

FLAC audio

.flac

FLAC marker

66 4C 61 43

ASCII fLaC

Byte offset
0
Media type
audio/flac

The fLaC marker introduces the FLAC stream and is followed by metadata blocks before the audio frames.

FLAC Format Specification
Audio

Ogg container

.ogg · .oga · .opus

Ogg page capture pattern

4F 67 67 53

ASCII OggS

Byte offset
0 for the first page
Media type
application/ogg

Ogg is a container format. The signature identifies an Ogg page, while stream headers identify the codec or media carried inside.

RFC 7845: Ogg Opus
Video

MP4 / ISO Base Media File

.mp4 · .m4v

File type box marker

66 74 79 70

ASCII ftyp

Byte offset
4
Media type
video/mp4

The ftyp box begins after its four-byte size field. Its major and compatible brands identify the media family, while track entries describe the codecs.

Library of Congress: QuickTime / ISO media
Video

Matroska / WebM container

.mkv · .webm

EBML header element ID

1A 45 DF A3
Byte offset
Beginning of EBML document
Media type
video/x-matroska · video/webm

The EBML header is followed by a DocType value such as matroska or webm. The header bytes alone identify the EBML family, not the specific container subtype.

RFC 9559: Matroska
Databases

SQLite database

.sqlite · .sqlite3 · .db

16-byte database header

53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00
Byte offset
0
Media type
application/vnd.sqlite3

Every valid SQLite 3 database begins with the 16-byte header string shown here, including its terminating zero byte.

SQLite File Format

Byte patterns

A signature is a recognizable byte sequence. It may appear at the beginning of a file or at a defined offset.

Containers

A container marker can identify a family without identifying every stream or subtype inside it. ZIP and ISO media files are common examples.

Text formats

XML-based and other text formats may allow declarations, whitespace or comments before their main element. They do not always have one fixed prefix.

Reading file signatures

A signature may be a fixed prefix, a marker at a defined offset or a pattern followed by container details. Related formats can share parts of a header, so the surrounding bytes help identify the specific format.

Explore the PRONOM format registry