File inspection

File type detector by magic bytes.

Pick one or more files to see what their first bytes say they are, whatever the name claims. Files are read in slices inside your browser and never uploaded.

What a magic-byte check tells you

Most binary file formats begin with a fixed pattern of bytes, often called a magic number or file signature. A PNG always starts with the eight bytes 89 50 4E 47 0D 0A 1A 0A, a PDF with the text %PDF-, a ZIP archive with PK followed by 03 04. This tool reads the start of each file you choose, compares it with a table of published signatures, and reports what the content says it is. The file name plays no part in the detection, which is the point: extensions are only labels and anyone can rename a file.

The check helps when a download will not open, a phone photo claims to be a JPG but an editor rejects it, or an attachment has no extension. Because files are read in slices, a 10 GB video is as quick to check as a 10 KB icon: only the first and last 64 KiB are touched (plus the directory of a ZIP-based file).

How it works

  1. The first 64 KiB of the file is read with File.slice (and the last 64 KiB, which is where a ZIP keeps its directory). Nothing is uploaded; the bytes stay in your browser tab.
  2. Each signature in the table is tested at its documented offset. Most sit at byte 0; tar uses byte 257, ISO 9660 disc images use byte 32,769, and ISO base media files (HEIC, AVIF, MP4, MOV, M4A) carry an ftyp box at byte 4 followed by a four-character brand.
  3. Container formats are looked at more closely. A ZIP is opened far enough to read its central directory, so the tool can tell a Word document (word/document.xml) from an Excel workbook, an OpenDocument file, an EPUB, a JAR or an Android package. RIFF files are split into WebP, WAV and AVI by their form type, and Matroska is split from WebM by its EBML document type.
  4. If nothing matches, the first 8 KB is tested for text. Text formats have no magic number, so the result is labelled a weak, sniffed guess.
  5. The end of the file is checked for a ZIP record, and the start for other well-known signatures, so a file valid as two formats at once can be pointed out.

Worked example: a phone photo that will not open

A photo named IMG_2041.jpg from an iPhone is refused by a web form. The detector reads the first bytes as 00 00 00 18 66 74 79 70 68 65 69 63. Bytes 4 to 7 spell ftyp and the major brand is heic, so the content is a HEIC image, not a JPEG, whatever the name says. The fix is to convert the image to JPEG rather than rename it again. The same logic explains why renaming .heic to .jpg never works.

Signatures this tool checks

These are the rows most people ask about. Offsets are in bytes from the start of the file, and each row names where the pattern is published.

FormatOffsetBytes (hex)Published in
PNG image089 50 4E 47 0D 0A 1A 0ARFC 2083 / ISO/IEC 15948 (PNG signature)
JPEG image0FF D8 FFITU-T T.81 (JPEG, SOI marker)
GIF image047 49 46 38 ?? 61GIF89a specification (header "GIF87a"/"GIF89a")
PDF document025 50 44 46 2DISO 32000 file header "%PDF-"
ZIP archive (also DOCX, XLSX, PPTX, JAR, APK, EPUB)050 4B 03 04PKWARE APPNOTE.TXT local file header
HEIC / HEIF / AVIF / MP4 / MOV / M4A (ISO base media)466 74 79 70 + 4-byte brandISO/IEC 14496-12 "ftyp" box; the brand names the exact type
OLE2 / Compound File (legacy Office, MSI, MSG)0D0 CF 11 E0 A1 B1 1A E1Microsoft [MS-CFB] Compound File Binary header
gzip archive01F 8B 08RFC 1952 (gzip)
7-Zip archive037 7A BC AF 27 1C7-Zip 7zFormat.txt (signature header)
tar archive (POSIX ustar)25775 73 74 61 72POSIX.1 ustar header, magic at offset 257
SQLite database053 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00SQLite file format, section 1.3 (magic header string)
ELF executable or library07F 45 4C 46System V ABI / ELF header e_ident

Gary Kessler's well-known list is a good cross-reference, but it is a collected reference, not a standard, so each signature was checked against the format's own specification where one is public.

Confidence levels, in plain words

Common mistakes

What this tool does not do

Your file stays on your device

The tool runs inside an isolated frame on this page that has no network permission: its content security policy forbids every outbound connection, and the frame carries no advertising or analytics scripts. The code uses File.slice to read the head and tail of each file into memory in your own browser tab and discards it when you choose another file or close the page. The advertising you see on the page sits outside the frame and cannot see which files you choose.

Common mix-ups

  1. W3C: Portable Network Graphics (PNG) Specification, PNG file signature
  2. RFC 4180: Common Format and MIME Type for CSV Files

Checked against these sources on .

Frequently asked questions

How can I tell what type a file really is?

Look at its first bytes. Most binary formats start with a fixed signature (a magic number), for example 89 50 4E 47 for PNG or 25 50 44 46 for PDF. This tool reads those bytes in your browser and names the format, ignoring the file name.

Why does my .jpg file say it is HEIC?

iPhones and many Android phones save photos as HEIC by default. If the file was renamed to .jpg without conversion, the content is still HEIC, shown by an ftyp box with the brand heic at byte 4. Convert it to JPEG instead of renaming it.

Does a match mean the file is safe?

No. A match only means the file starts like that format. A genuine PDF or Word document can still carry malicious content, and a damaged file can start with a perfect signature. This tool is not malware detection.

Why is a .docx file reported as a ZIP?

Word, Excel and PowerPoint files are ZIP packages. The tool opens the ZIP directory and looks for word/, xl/ or ppt/ parts to name the exact type. If the directory cannot be read or has no such parts, it falls back to plain ZIP.

Why does a CSV or text file show no signature?

Plain text formats have no magic number. The tool tests whether the first 8 KB decodes as text and labels the result as a weak guess. It cannot confirm that a .csv is valid CSV.

Is my file uploaded?

No. The file is read in slices by your browser, inside a frame that has no network access and no advertising or analytics code. Nothing leaves your device.

How large a file can I check?

There is no fixed size limit because only the start and end of the file are read: the first and last 64 KiB, plus the directory of a ZIP-based file. ZIP directories over 16 MiB are refused, archives are not unpacked beyond the few small marker parts needed to tell Word from Excel from PowerPoint, and archives inside archives are never opened.

Which file types are supported?

More than 60 formats covering common images, documents, archives, audio and video containers, executables, fonts and databases, plus HEIC, AVIF, MP4, MOV and M4A brands and Office, OpenDocument, EPUB, JAR and APK packages. Anything else reports as unrecognised.

Sources

Sources last checked 2026-11-11.

Advertisement
Advertisement