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
- 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. - 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
ftypbox at byte 4 followed by a four-character brand. - 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. - 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.
- 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.
| Format | Offset | Bytes (hex) | Published in |
|---|---|---|---|
| PNG image | 0 | 89 50 4E 47 0D 0A 1A 0A | RFC 2083 / ISO/IEC 15948 (PNG signature) |
| JPEG image | 0 | FF D8 FF | ITU-T T.81 (JPEG, SOI marker) |
| GIF image | 0 | 47 49 46 38 ?? 61 | GIF89a specification (header "GIF87a"/"GIF89a") |
| PDF document | 0 | 25 50 44 46 2D | ISO 32000 file header "%PDF-" |
| ZIP archive (also DOCX, XLSX, PPTX, JAR, APK, EPUB) | 0 | 50 4B 03 04 | PKWARE APPNOTE.TXT local file header |
| HEIC / HEIF / AVIF / MP4 / MOV / M4A (ISO base media) | 4 | 66 74 79 70 + 4-byte brand | ISO/IEC 14496-12 "ftyp" box; the brand names the exact type |
| OLE2 / Compound File (legacy Office, MSI, MSG) | 0 | D0 CF 11 E0 A1 B1 1A E1 | Microsoft [MS-CFB] Compound File Binary header |
| gzip archive | 0 | 1F 8B 08 | RFC 1952 (gzip) |
| 7-Zip archive | 0 | 37 7A BC AF 27 1C | 7-Zip 7zFormat.txt (signature header) |
| tar archive (POSIX ustar) | 257 | 75 73 74 61 72 | POSIX.1 ustar header, magic at offset 257 |
| SQLite database | 0 | 53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00 | SQLite file format, section 1.3 (magic header string) |
| ELF executable or library | 0 | 7F 45 4C 46 | System 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
- Strong match: a signature of four or more distinctive bytes matched, usually with a structural check (a PE file must have a
PEheader where the DOS header points; a GIF must say 87a or 89a). - Moderate match: a shorter or shared pattern, such as TIFF (also the base of many camera raw formats), or a PDF whose header does not start at byte 0.
- Weak match: two- or three-byte patterns and text sniffing.
MZalone is just two letters, andFF FBcan start an MP3 or be chance. Treat these as hints. - No match: no signature in the table matched. Many perfectly healthy formats have no magic number at all, including CSV, plain text and most source code.
Common mistakes
- Reading a match as a safety verdict. A file that really is a PDF can still contain malicious script. A signature says what the file starts with, nothing about what it does.
- Trusting the extension of a ZIP-based file. .docx, .xlsx, .jar, .apk and .epub are all ZIP archives; the first bytes are identical. Only the contents separate them, which is why the tool opens the directory.
- Expecting every file to have a signature. A "no match" on a .csv or .log is normal.
What this tool does not do
- It is not malware detection and does not scan content, check certificates, or look at hash reputation.
- It does not prove a file is undamaged. A truncated PNG still starts with the PNG signature.
- It does not read the contents of encrypted archives or documents.
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
-
Often assumedRenaming photo.png to photo.jpg turns it into a JPEG.
What the source saysA PNG file begins with an eight-byte signature (89 50 4E 47 0D 0A 1A 0A in hex) defined in the PNG specification. A new file name does not change those bytes, so tools that read the content still see a PNG. [1]
-
Often assumedEvery file type has a magic number, so 'no match' means the file is damaged.
What the source saysPlain-text formats do not. RFC 4180 defines CSV as lines of comma-separated fields and describes no leading signature, so a healthy .csv correctly shows no match. [2]
- W3C: Portable Network Graphics (PNG) Specification, PNG file signature
- 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.
- PNG signature, RFC 2083: www.rfc-editor.org/rfc/rfc2083 (eight-byte PNG signature).
- PNG Specification, W3C (ISO/IEC 15948): www.w3.org/TR/png (file signature section).
- JPEG, ITU-T T.81: www.w3.org/Graphics/JPEG/itu-t81.pdf (start-of-image marker).
- GIF89a specification: www.w3.org/Graphics/GIF/spec-gif89a.txt (GIF87a / GIF89a header).
- PDF 32000-1:2008, Adobe-hosted copy: opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf (file header).
- ZIP APPNOTE.TXT, PKWARE: pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT (local file header and central directory).
- ISO base media file format, Library of Congress description: www.loc.gov/preservation/digital/formats/fdd/fdd000079.shtml (ftyp box and brands).
- HEIF, Library of Congress description: www.loc.gov/preservation/digital/formats/fdd/fdd000525.shtml (HEIF brand usage).
- Office Open XML, ECMA-376: ecma-international.org/publications-and-standards/standards/ecma-376 (package layout).
- Compound File Binary, MS-CFB: learn.microsoft.com/en-us/openspecs/windows_protocols/ms-cfb/53989ce4-7b05-4f8d-829b-d08d6148375b (OLE2 header signature).
- PE format, Microsoft: learn.microsoft.com/en-us/windows/win32/debug/pe-format (MZ header and PE signature).
- ELF header, Linux Foundation: refspecs.linuxfoundation.org/elf/gabi4+/ch4.eheader.html (e_ident magic).
- EBML, RFC 8794: www.rfc-editor.org/rfc/rfc8794 (Matroska and WebM header).
- File signatures table, Gary Kessler: www.garykessler.net/library/file_sigs.html (cross-reference, not a standard).
- Blob.slice, MDN: developer.mozilla.org/en-US/docs/Web/API/Blob/slice (reading part of a file).