Magic byte and file signature table
Look up any file format by its magic bytes, or any byte sequence by format - including the trailers that mark where a file ends.
Open in ctfpalA reference for the bytes that identify a format, in both directions: given bytes, what is it; given a format, what should its bytes be. The second direction matters when a challenge has corrupted a header and you need to repair it.
Repairing a broken header
A common challenge shape is a file whose first few bytes have been zeroed or altered so nothing will open it. If the rest of the structure is intact - a PNG with valid IHDR and IDAT chunks but a mangled signature - writing the correct magic bytes back restores it completely. Knowing what those bytes should be is the whole puzzle.
- PNG starts
89 50 4E 47 0D 0A 1A 0Aand ends with theIENDchunk plus its CRC. - JPEG starts
FF D8 FFand endsFF D9. - ZIP starts
50 4B 03 04; its central directory at the end starts50 4B 01 02, and the end-of-central-directory record starts50 4B 05 06. - GIF starts
GIF87aorGIF89a- the version is literal ASCII. - PDF starts
%PDF-and should end%%EOF.
Part of a module
7. File forensics and carving
Identify files by their bytes, find data appended past a format’s end marker, and pull evidence out of images and documents.
Practise on real challenges
Related tools
File type identifier by magic bytes
Drop a file and identify what it really is from its signature, regardless of extension. Also finds file headers embedded inside other files.
Hex viewer and hexdump
Inspect any file byte by byte with a side-by-side hex and ASCII view, offsets, and structure highlighting.
ZIP archive inspector
Read a ZIP’s central directory and local headers, spot mismatches used to hide files, and check encryption and compression per entry.
Hex to text converter
Convert hexadecimal to text and back, tolerating whitespace, commas, and `0x` prefixes. Runs entirely in your browser.