Skip to content
UniKit

Magic bytes reference

Identify file types by real magic bytes: 162 signatures from public specs (PNG, JPEG, ZIP, ELF, SQLite, 7z, WASM and more), matched against a pasted hex header or the first 4096 bytes of a local file, plus search by hex prefix, extension or category.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

File header (hex)

Hex accepts spaces, commas, colons and 0x / \x prefixes. The first few dozen bytes are enough; a shorter input is matched as a prefix (at least 2 bytes).

Only the first 4096 bytes are read, locally, and nothing is uploaded.

Header identification

Matches are ranked by the number of literal bytes matched, so the first line is the most likely type; formats sharing a signature (such as CAFEBABE) are listed together.

Paste a file header in hex or pick a file to identify its type

Reference table search

A hex prefix is matched against literal bytes (?? wildcards are skipped); extensions work with or without the dot, and an empty query browses the whole table.

Entries: 162 · Shown: 60

PNG imageImage .png
89 50 4E 47 0D 0A 1A 0A

Source: PNG 规范 (ISO/IEC 15948) §5.2 Signature

JPEG / JFIF imageImage .jpg .jpeg .jpe .jfif
FF D8 FF E0 00 10 4A 46 49 46 00 01

Source: JFIF 1.02 规范 (ITU-T T.871) §4.1

JPEG / Exif imageImage .jpg .jpeg
FF D8 FF E1

Source: Exif 2.3 规范 (CIPA DC-008) APP1 标记

Raw JPEG stream (no APPn)Image .jpg .jpeg
FF D8 FF DB

Source: JPEG 规范 (ITU-T T.81) 标记码表

JPEG 2000 imageImage .jp2 .j2k
00 00 00 0C 6A 50 20 20 0D 0A 87 0A

Source: JPEG 2000 (ISO/IEC 15444-1) §I.5.1 Signature box

JPEG 2000 codestreamImage .j2c .j2k
FF 4F FF 51

Source: JPEG 2000 (ISO/IEC 15444-1) Annex A 标记

GIF87a imageImage .gif
47 49 46 38 37 61

Source: GIF87a 规范 §17 Header

GIF89a imageImage .gif
47 49 46 38 39 61

Source: GIF89a 规范 §17 Header

BMP bitmapImage .bmp .dib
42 4D

Source: Windows BITMAPFILEHEADER (Win32 API 文档)

TIFF image (little endian)Image .tif .tiff
49 49 2A 00

Source: TIFF 6.0 规范 §2 Image File Header

TIFF image (big endian)Image .tif .tiff
4D 4D 00 2A

Source: TIFF 6.0 规范 §2 Image File Header

WebP imageImage .webp
52 49 46 46 ?? ?? ?? ?? 57 45 42 50

Source: WebP 容器规范 (RFC 9649) §2.1

Windows iconImage .ico
00 00 01 00

Source: ICO 格式 (Microsoft ICONDIR 结构)

Windows cursorImage .cur
00 00 02 00

Source: CUR 格式 (Microsoft ICONDIR 结构)

macOS iconImage .icns
69 63 6E 73

Source: Apple Icon Image 格式文档

Photoshop documentImage .psd .psb
38 42 50 53

Source: Adobe Photoshop File Format 文档

GIMP projectImage .xcf
67 69 6D 70 20 78 63 66 20 66 69 6C 65

Source: GIMP XCF 文件格式说明

DirectDraw surfaceImage .dds
44 44 53 20

Source: Microsoft DirectDraw Surface (DDS) 文档

KTX texture (version 1)Image .ktx
AB 4B 54 58 20 31 31

Source: Khronos KTX 1 文件格式规范

KTX texture (version 2)Image .ktx2
AB 4B 54 58 20 32 30

Source: Khronos KTX 2 文件格式规范

ASTC textureImage .astc
13 AB A1 5C

Source: ARM ASTC 纹理压缩格式文档

QOI imageImage .qoi
71 6F 69 66

Source: QOI 格式规范 (qoi-spec)

OpenEXR imageImage .exr
76 2F 31 01

Source: OpenEXR 文件格式规范 §1

FLIF imageImage .flif
46 4C 49 46

Source: FLIF 格式说明 (flif.info)

BPG imageImage .bpg
42 50 47 FB

Source: BPG 格式规范 (bellard.org/bpg)

JPEG XL codestreamImage .jxl
FF 0A

Source: JPEG XL (ISO/IEC 18181-1) §7.1

JPEG XL containerImage .jxl
00 00 00 0C 4A 58 4C 20 0D 0A 87 0A

Source: JPEG XL 容器格式 (ISO/IEC 18181-2) §4.2

JPEG XR / HD PhotoImage .jxr .hdp .wdp
49 49 BC 01

Source: JPEG XR (ISO/IEC 29199-2) 文件格式

FITS astronomy dataImage .fits .fit .fts
53 49 4D 50 4C 45 20 20 3D

Source: FITS 标准 (IAU FITS 4.0) §4.1

Netpbm PPM imageImage .ppm .pnm
50 36

Source: Netpbm 格式文档 (ppm 手册)

Netpbm PGM imageImage .pgm .pnm
50 35

Source: Netpbm 格式文档 (pgm 手册)

Netpbm PBM imageImage .pbm .pnm
50 31

Source: Netpbm 格式文档 (pbm 手册)

Windows animated cursorImage .ani
52 49 46 46 ?? ?? ?? ?? 41 43 4F 4E

Source: Microsoft RIFF ACON 格式文档

HEIC / HEIF imageImage .heic .heif
66 74 79 70 68 65 69 63

Source: ISO/IEC 23008-12 (HEIF) / ISO/IEC 14496-12 ftyp

AVIF imageImage .avif
66 74 79 70 61 76 69 66

Source: AVIF 规范 (AOMedia) / ISO/IEC 14496-12 ftyp

MP4 videoVideo .mp4 .m4v
66 74 79 70 69 73 6F 6D

Source: ISO/IEC 14496-12 (ISOBMFF) §4.3 File Type Box

ISOBMFF container (generic ftyp)Video .mp4 .mov .m4a .m4v .3gp .heic .avif
66 74 79 70

Source: ISO/IEC 14496-12 §4.3 File Type Box

QuickTime movieVideo .mov .qt
6D 6F 6F 76

Source: QuickTime File Format 文档 (Apple)

AVI videoVideo .avi
52 49 46 46 ?? ?? ?? ?? 41 56 49 20

Source: AVI 文件格式 (Microsoft RIFF AVI)

MP4 audio (M4A)Audio .m4a .m4b
66 74 79 70 4D 34 41 20

Source: ISO/IEC 14496-12 §4.3 / Apple M4A brand

3GPP videoVideo .3gp .3g2
66 74 79 70 33 67 70

Source: 3GPP TS 26.244 (3GPP 文件格式)

Matroska / WebMVideo .mkv .mka .mks .webm
1A 45 DF A3

Source: EBML (RFC 8794) §11 / Matroska 规范

FLV videoVideo .flv .f4v
46 4C 56 01

Source: Adobe FLV/F4V 格式规范

MPEG-1/2 program streamVideo .mpg .mpeg .vob
00 00 01 BA

Source: MPEG-1 (ISO/IEC 11172-1) / MPEG-2 (13818-1) 系统层

MPEG video sequenceVideo .m2v .mpv
00 00 01 B3

Source: MPEG-2 (ISO/IEC 13818-2) 语法

MPEG transport streamVideo .ts .m2ts .mts
47

Source: MPEG-2 (ISO/IEC 13818-1) 传输流语法

ASF / WMV / WMAVideo .asf .wmv .wma
30 26 B2 75 8E 66 CF 11 A6 D9 00 AA 00 62 CE 6C

Source: ASF 规范 (Microsoft) §3.1 Header Object

RealMedia videoVideo .rm .rmvb .ra
2E 52 4D 46

Source: RealMedia 文件格式文档 (RealNetworks)

IVF video streamVideo .ivf
44 4B 49 46

Source: IVF 格式说明 (libwebm / VP8 测试码流)

MXF professional mediaVideo .mxf
06 0E 2B 34 02 05 01 01 0D 01 02

Source: SMPTE 377M (MXF) KLV 键定义

FLAC audioAudio .flac
66 4C 61 43

Source: FLAC 格式规范 §Stream 标记

Ogg container (Vorbis/Opus/Theora)Audio .ogg .oga .ogv .opus .spx
4F 67 67 53

Source: Ogg 封装 (RFC 3533) §6

MP3 with an ID3v2 tagAudio .mp3
49 44 33

Source: ID3v2.4 规范 §3

MP3 audio frame (MPEG-1)Audio .mp3
FF FB

Source: MPEG-1 (ISO/IEC 11172-3) 帧头语法

MP3 audio frame (MPEG-2)Audio .mp3
FF F3

Source: MPEG-2 (ISO/IEC 13818-3) 帧头语法

AAC (ADTS stream)Audio .aac
FF F1

Source: MPEG-4 Audio (ISO/IEC 14496-3) ADTS 语法

WAV audioAudio .wav .wave
52 49 46 46 ?? ?? ?? ?? 57 41 56 45

Source: RIFF WAVE 格式 (Microsoft Multimedia Standards Update)

AIFF audioAudio .aiff .aif .aifc
46 4F 52 4D ?? ?? ?? ?? 41 49 46 46

Source: AIFF-C 规范 (Apple, EA IFF 85 派生)

AIFF-C compressed audioAudio .aifc .aif
46 4F 52 4D ?? ?? ?? ?? 41 49 46 43

Source: AIFF-C 规范 (Apple)

MIDI fileAudio .mid .midi .rmi
4D 54 68 64

Source: SMF 规范 (MIDI 1.0 标准文件格式)

What this tool does

  • Confirm the real type of a file that has no extension or a suspicious one, using just its first few dozen bytes
  • Debug "this file will not open": check whether a ZIP was renamed to .jpg, or UTF-16 text is being treated as binary
  • Use it as a reference: look signatures up by hex prefix such as 89 50 4E 47, by extension or by category, each with its source

Example

Input

89 50 4E 47 0D 0A 1A 0A

Output

bytes: 8
matches: 1
png | 89 50 4E 47 0D 0A 1A 0A | .png | image | matched 8/8

Each line is: entry id | signature | extensions | category | literal bytes matched / total literal bytes.

Frequently asked questions

How many entries are there and what are they based on?

162 signatures covering images, audio/video, archives, documents, executables, fonts, databases, disk images, certificates and keys. Every entry carries a source field (PNG spec §5.2, RFC 1952, PKWARE APPNOTE 6.3.10, SQLite file format §1.2 and so on) instead of guesswork; formats that are missing simply report "no signature matched".

How do you decide when several signatures match?

Matches are ranked by the number of literal bytes matched, so the first line is the most likely type. Formats that share a signature are listed together: CAFEBABE is both a Java class and a Mach-O universal binary, and the RIFF prefix belongs to WebP, WAV, AVI and ANI alike — you need the following bytes or the internal entries to settle it.

Can a few bytes be enough?

Yes. When the input is shorter than a signature it is matched as a prefix, but at least 2 literal bytes must match so that 1-byte signatures (MPEG-TS 0x47, EOT 4C 50) do not fire everywhere; those lines are marked (prefix).

Can magic bytes replace real format parsing?

No. A header only says what the file claims to be and can be forged with a few bytes; a renamed ZIP is still a ZIP, and docx/xlsx/pptx/apk/jar are all ZIP files that need their internal entries inspected. Security decisions require parsing the structure — this tool only compares signatures, does not validate integrity, and reads at most the first 4096 bytes for comparison.

Does picking a file leak its content?

No network access is used. The browser reads the file locally with FileReader and only the first 4096 bytes are converted to hex, so even huge files answer instantly. You can also copy the header bytes yourself and paste them.

Keywords:magic bytes文件头文件签名文件类型检测magic numberfile signature十六进制文件头PNG 89 50 4E 47file type checker

Related tools