File Signatures & Magic BytesRutvij Khatri•10 min read•Published 2026-10-14

The Definitive Guide to Image File Signatures and Hex Headers for Examiners

An authoritative reference manual of magic bytes, trailer markers, and container structures for JPEG, PNG, GIF, BMP, TIFF, WebP, and AVIF.

Executive Verdict & Direct Answer
✓ 100% Client-Side In-Browser Engine

An authoritative reference manual of magic bytes, trailer markers, and container structures for JPEG, PNG, GIF, BMP, TIFF, WebP, and AVIF. Always verify file integrity using magic bytes rather than file extensions. Magic bytes define the actual binary structure of the container.

Why File Extensions Lie

In incident response, malware forensics, and web security auditing, trusting file extensions is a dangerous vulnerability. Attackers routinely rename malicious executables (`malware.exe`) to innocent extensions (`invoice.jpg` or `profile.png`) to bypass upload filters or deceive victims.

Relying on signature-based byte verification is the foundational rule of computer forensics. Understanding the exact hex signatures of major image containers allows examiners to quickly profile files and identify disguised binaries.

Key Investigative Takeaway

Always verify file integrity using magic bytes rather than file extensions. Magic bytes define the actual binary structure of the container.

Exhaustive Signature Reference Table

1. JPEG: `FF D8 FF` (Variable 4th byte: `E0` for JFIF, `E1` for EXIF, `EE` for Adobe). EOI Trailer: `FF D9`.

2. PNG: `89 50 4E 47 0D 0A 1A 0A`. Trailer: `49 45 4E 44 AE 42 60 82`.

3. GIF: `47 49 46 38 37 61` (GIF87a) or `47 49 46 38 39 61` (GIF89a). Trailer: `3B`.

4. BMP: `42 4D` (ASCII "BM") followed by a 4-byte file size.

5. TIFF: Little-Endian: `49 49 2A 00` ("II*\0"); Big-Endian: `4D 4D 00 2A` ("MM\0*").

6. WebP / RIFF: `52 49 46 46` ... `57 45 42 50`.

7. HEIC / AVIF: Begins with 4-byte length, then `66 74 79 70` (ftyp), followed by major brand `68 65 69 63` or `61 76 69 66`.

Signature Verification in OverlayCheck

OverlayCheck matches file headers against a comprehensive database of over 120 standardized binary signatures, reporting MIME mismatches, extension spoofing, and corrupted byte markers in real time.

Signature Verification Mechanisms

Evaluating signature depth, format accuracy, and spoof detection.

Feature / DimensionOverlayCheck (Client-Side)Linux file Utility (libmagic)Windows File Explorer
Signature Spoof Detection
Alerts if extension contradicts magic bytes
Accurate (Ignores extension, inspects bytes)Blind (Relies entirely on file extension)

Command-Line Automation & CLI Workflows

For security engineers and forensic examiners automating pipelines or conducting terminal audits, the equivalent low-level commands can be executed natively:

Inspect First 16 Bytes via Linux Xxd
bash
xxd -l 16 suspect_file.jpg
Technical Breakdown: Dumps the first 16 bytes of the file in hexadecimal and ASCII to inspect the file signature.

Frequently Asked Technical Questions

Q1:Can a file have valid magic bytes and still be malicious?

Yes. In polyglot files or appended data attacks, the image starts with legitimate magic bytes, but embeds secondary malicious payloads elsewhere in the file.

#image file signatures reference#magic bytes list forensics#hex headers image formats#file carving signatures#identify file by hex
RK
Rutvij KhatriSecurity Analyst & Aspiring Security Engineer

Security Analyst and Aspiring Security Engineer passionate about client-side media verification, binary parsing, web application security auditing, CTF steganography challenges, and zero-knowledge privacy architecture.

Connect on LinkedIn

Companion Verification & Privacy Toolkits

Cross-Cluster Workflows

Related Deep Dives in File Signatures & Magic Bytes