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
- Browse the table — All known magic bytes signatures are displayed in a searchable table.
- Search — Type an extension (.pdf, .zip), hex bytes (50 4B 03 04), or a description to filter results.
- Filter by category — Use the dropdown to narrow results to a specific category such as Image, Archive or Video.
- Read the offset — Check the byte position column so you know exactly where the signature is expected to appear.
- 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 | .zip | 50 4B 03 04 | 0 | Archive |
| Gzip | .gz | 1F 8B | 0 | Archive |
| Bzip2 | .bz2 | 42 5A 68 | 0 | Archive |
| 7-Zip | .7z | 37 7A BC AF 27 1C | 0 | Archive |
| TAR | .tar | 75 73 74 61 72 (ustar) | 257 | Archive |
| XZ | .xz | FD 37 7A 58 5A 00 | 0 | Archive |
| PNG | .png | 89 50 4E 47 0D 0A 1A 0A | 0 | Image |
| JPEG | .jpg | FF D8 FF | 0 | Image |
| GIF | .gif | 47 49 46 38 (GIF8) | 0 | Image |
| WebP | .webp | 52 49 46 46 ?? ?? ?? ?? 57 45 42 50 | 0 | Image |
| WAV | .wav | 52 49 46 46 ?? ?? ?? ?? 57 41 56 45 | 0 | Audio |
| MP3 (ID3) | .mp3 | 49 44 33 (ID3) | 0 | Audio |
| FLAC | .flac | 66 4C 61 43 (fLaC) | 0 | Audio |
| OGG | .ogg | 4F 67 67 53 (OggS) | 0 | Audio |
| MP4 / MOV | .mp4 | 66 74 79 70 (ftyp) | 4 | Video |
| Matroska / WebM | .mkv | 1A 45 DF A3 | 0 | Video |
| 25 50 44 46 (PDF) | 0 | Document | ||
| EPUB | .epub | 6D 69 6D 65 74 79 70 65 (mimetype) | 30 | Document |
| ISO 9660 | .iso | 43 44 30 30 31 (CD001) | 32769 / 32771 | System |
| NTFS | .img | 4E 54 46 53 (NTFS) | 3 | System |
| ext filesystem | .img | 53 EF | 0x438 (1080) | System |
| TrueType | .ttf | 00 01 00 00 | 0 | Font |
| OpenType | .otf | 4F 54 54 4F (OTTO) | 0 | Font |
| WOFF | .woff | 77 4F 46 46 (wOFF) | 0 | Font |
| HTML | .html | 3C 21 44 4F 43 54 59 50 45 (!DOCTYPE) | 0 | Web |
| SQLite | .sqlite | 53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00 | 0 | Data |
| Binary glTF | .glb | 67 6C 54 46 (glTF) | 0 | 3D |
| AutoCAD DWG | .dwg | 41 43 31 30 (AC10) | 0 | CAD |
Worked Examples
- Renamed image — a file called
photo.txtthat starts with89 50 4E 47is really a PNG image. - Archive sniffing — bytes
50 4B 03 04at 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
ustarat byte 257. - Wildcard match — WebP begins with
RIFF, four variable size bytes, thenWEBP, so the tool shows?? ?? ?? ??in the middle. - Disk image — an ext filesystem image shows
53 EFat offset 0x438, far past the start of the file. - Video container — MP4 and MOV files carry the
ftyptag 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
!DOCTYPEorustarassume 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.
- Recovering unknown files — identify the real type of a file that has lost or been given a wrong extension.
- Digital forensics — confirm what a file actually is during an investigation instead of trusting metadata.
- Verifying downloads — check that a downloaded file's leading bytes match the format you expected.
- Malware triage — spot executables and scripts disguised with innocent-looking extensions.
- Data recovery — carve files out of disk images by scanning for known signatures.
- 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.