File Magic Bytes Reference

Browse file signatures (magic bytes) to identify file types from their hex headers. Search by extension, hex signature, or description.

Magic Bytes Reference

What are Magic Bytes?

Magic bytes, also called a file signature or magic number, are the first few bytes stored at a fixed position inside a file that identify its format. Long before any application reads the rest of the data, it can look at those leading bytes and know whether it is holding a PNG image, a ZIP archive, a PDF document, or an executable. This is the mechanism behind commands like the Unix file utility, which sniffs the content rather than trusting the filename.

This reference collects around 140 well-known signatures across twelve categories: Archive, Image, Audio, Video, Document, System, Mobile, Web, Font, Data, 3D and CAD. Each entry lists an extension, the hexadecimal magic bytes, and the byte offset where the signature begins. Most formats place their signature at offset 0, but several important ones do not, which is why the offset column matters.

Some signatures live much later in the file. The TAR archive format stores its ustar marker at byte 257, the ISO 9660 optical-disc format places CD001 at offsets such as 32769 and 32771, the EPUB container puts its mimetype entry at byte 30, NTFS volumes carry NTFS at byte 3, and the ext family of Linux filesystems stores its magic at offset 0x438, which is decimal 1080. RIFF-based formats such as WAV, AVI and WebP share a RIFF header followed by a four-byte size and then a format tag, so the tool represents the variable size bytes with ?? wildcards.

The entire reference is client-side. You can search by extension, description, or hex bytes, and filter by category to narrow the list. Nothing is uploaded and no data leaves your browser. Keep in mind that magic bytes are strong evidence of a format but not absolute proof: a determined attacker can craft a file whose signature and contents disagree, so never treat a matching signature as a guarantee of safety.

Key Concepts

  • File signature — the leading bytes that identify a format regardless of the filename extension.
  • Offset — the byte position where the signature begins; most are at 0 but several are far into the file.
  • Hex notation — signatures are shown as hexadecimal byte pairs like 89 50 4E 47.
  • Wildcards — ?? marks a variable byte, as used in RIFF-based formats.
  • Categories — signatures are grouped into Archive, Image, Audio, Video, Document, System, Mobile, Web, Font, Data, 3D and CAD.
  • Heuristic — a matching signature is strong evidence, not a security guarantee, of a file's true type.

How to Use

  1. Browse the table — All known magic bytes signatures are displayed in a searchable table.
  2. Search — Type an extension (.pdf, .zip), hex bytes (50 4B 03 04), or a description to filter results.
  3. Filter by category — Use the dropdown to narrow results to a specific category such as Image, Archive or Video.
  4. Read the offset — Check the byte position column so you know exactly where the signature is expected to appear.
  5. Verify against a hex dump — Compare the listed bytes with a hex editor or xxd output to confirm the format.

Magic Bytes Reference

Format Extension Magic Bytes Offset Category
ZIP / JAR / APK.zip50 4B 03 040Archive
Gzip.gz1F 8B0Archive
Bzip2.bz242 5A 680Archive
7-Zip.7z37 7A BC AF 27 1C0Archive
TAR.tar75 73 74 61 72 (ustar)257Archive
XZ.xzFD 37 7A 58 5A 000Archive
PNG.png89 50 4E 47 0D 0A 1A 0A0Image
JPEG.jpgFF D8 FF0Image
GIF.gif47 49 46 38 (GIF8)0Image
WebP.webp52 49 46 46 ?? ?? ?? ?? 57 45 42 500Image
WAV.wav52 49 46 46 ?? ?? ?? ?? 57 41 56 450Audio
MP3 (ID3).mp349 44 33 (ID3)0Audio
FLAC.flac66 4C 61 43 (fLaC)0Audio
OGG.ogg4F 67 67 53 (OggS)0Audio
MP4 / MOV.mp466 74 79 70 (ftyp)4Video
Matroska / WebM.mkv1A 45 DF A30Video
PDF.pdf25 50 44 46 (PDF)0Document
EPUB.epub6D 69 6D 65 74 79 70 65 (mimetype)30Document
ISO 9660.iso43 44 30 30 31 (CD001)32769 / 32771System
NTFS.img4E 54 46 53 (NTFS)3System
ext filesystem.img53 EF0x438 (1080)System
TrueType.ttf00 01 00 000Font
OpenType.otf4F 54 54 4F (OTTO)0Font
WOFF.woff77 4F 46 46 (wOFF)0Font
HTML.html3C 21 44 4F 43 54 59 50 45 (!DOCTYPE)0Web
SQLite.sqlite53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 000Data
Binary glTF.glb67 6C 54 46 (glTF)03D
AutoCAD DWG.dwg41 43 31 30 (AC10)0CAD

Worked Examples

  • Renamed image — a file called photo.txt that starts with 89 50 4E 47 is really a PNG image.
  • Archive sniffing — bytes 50 4B 03 04 at offset 0 indicate a ZIP container, which also covers DOCX, XLSX and APK files.
  • Later-offset signature — a TAR file looks like random data for 256 bytes, then shows ustar at byte 257.
  • Wildcard match — WebP begins with RIFF, four variable size bytes, then WEBP, so the tool shows ?? ?? ?? ?? in the middle.
  • Disk image — an ext filesystem image shows 53 EF at offset 0x438, far past the start of the file.
  • Video container — MP4 and MOV files carry the ftyp tag at offset 4 rather than at the very beginning.

Tips and Common Mistakes

  • Do not trust the extension alone — a file's name is a claim, while its magic bytes are evidence of the actual format.
  • Check the offset — searching only the first bytes will miss formats such as TAR, ISO 9660, EPUB and ext that store their signature far later.
  • Remember the wildcards — RIFF-based formats vary in size bytes, so a literal byte-for-byte comparison will fail without accounting for ??.
  • ZIP is a family, not a type — many unrelated formats share the PK header, so you may need to inspect the archive contents to distinguish them.
  • A match is not proof of safety — signatures can be spoofed, so never rely on them as a security check on their own.
  • Case and text encoding matter — text-based signatures such as !DOCTYPE or ustar assume a specific encoding and casing.

Common Use Cases

Knowing a file's signature is useful in many everyday and technical situations. These are the scenarios where this reference saves the most time.

  1. Recovering unknown files — identify the real type of a file that has lost or been given a wrong extension.
  2. Digital forensics — confirm what a file actually is during an investigation instead of trusting metadata.
  3. Verifying downloads — check that a downloaded file's leading bytes match the format you expected.
  4. Malware triage — spot executables and scripts disguised with innocent-looking extensions.
  5. Data recovery — carve files out of disk images by scanning for known signatures.
  6. Format research — learn how different formats identify themselves through their on-disk headers when building parsers and tools.

Frequently Asked Questions

What are magic bytes?

Magic bytes, also called file signatures or magic numbers, are the first few bytes of a file that identify its format. Applications use them to determine the file type even when the extension is missing or wrong.

What does "Offset" mean?

The offset is the byte position where the signature begins. Most signatures start at offset 0, but some formats place their identifier at a fixed position later in the file, such as TAR at byte 257.

How can I use this information?

You can use magic bytes to identify a file with a missing or incorrect extension, verify file integrity, recover type information from damaged files, or study how a format is structured.

How do I view a file's hex bytes?

Use a hex editor such as HxD, 010 Editor or Hex Fiend, or a command-line tool like xxd or hexdump on Linux and macOS to view the raw bytes of a file.

Why do some formats use question-mark placeholders?

RIFF-based formats such as WAV, AVI and WebP begin with a RIFF tag, then four size bytes that vary per file, then a format tag. The ?? placeholders represent those variable size bytes.

Does a matching signature prove a file is safe?

No. Magic bytes are strong evidence of a format but they can be forged. A file whose signature matches an expected type may still contain malicious content, so treat this as identification rather than a security check.

Why do many files share the same signature?

Some signatures cover a whole family of formats. The PK header, for example, marks ZIP archives and also Office documents, JAR files and Android APKs, which are all ZIP containers underneath.

Is this reference free and private?

Yes. The reference runs entirely in your browser. Searching and filtering happen locally and no data is uploaded to any server.

Related Tools