File Format Doctor
Find out what a file really is from its bytes, why it will not open and how to convert it.
How it works
Upload a file (or paste its first bytes as hex) and the doctor reads its magic number against a table of 74 formats, looks inside ZIP containers (DOCX, XLSX, ODT, EPUB, JAR, APK), and diagnoses wrong extensions, truncated or encrypted files, text encoding problems and disguised executables — with offline conversion commands.
- Magic numbers are matched at their documented offsets for 74 formats (e.g. "%PDF-" at 0, "ustar" at 257, "CD001" at 0x8001, "ftyp" brands at 4).
- ISO-BMFF files are told apart by their ftyp brands (heic/heix → HEIC, mif1 → HEIF, avif → AVIF, qt → QuickTime, M4A → audio, isom/mp42 → MP4).
- ZIP files are opened by reading the central directory (or local file headers in a sample): [Content_Types].xml + word/ → DOCX, xl/ → XLSX, ppt/ → PPTX, the stored "mimetype" entry → ODT/ODS/ODP/EPUB, AndroidManifest.xml → APK, META-INF/MANIFEST.MF → JAR. General-purpose bit 0 marks encrypted entries.
- Without a binary signature the bytes are checked for BOMs, UTF-16 patterns, strict UTF-8 validity and typical mojibake sequences (e.g. "é", "’"), then for SVG/HTML/XML/JSON/CSV structure.
- Truncation checks (uploads only): PDF must end with %%EOF, PNG with IEND, JPEG with FF D9, GIF with 3B, ZIP must have an end-of-central-directory record, RIFF/BMP declared sizes must fit.
- Conversion suggestions use free, offline tools (LibreOffice, ImageMagick, FFmpeg, 7-Zip, iconv) with the exact command for your file name.
Detection reads bytes only; it does not scan for malware. Never run an executable you did not expect to receive.
Sources
- List of file signatures (Wikipedia) retrieved 2026-10-12
- APPNOTE.TXT – .ZIP File Format Specification (PKWARE) retrieved 2026-10-12
- Registered brands (MP4 Registration Authority) retrieved 2026-10-12
Use this tool in an app
These free programs for your browser have this tool built in, next to everything else the task needs.
-
Paperwell Document studio: PDFs, OCR, redaction, forms & contract reading
Your paperwork in one dossier: PDF tools, OCR, redaction, forms and contract reading.
-
Bundlekeep Local project backup
Back up projects from every usefulweb app into one file, check it and restore any part.
Related tools
- FileFit – Can this app open, edit or convert that file format? Verified facts with sources.
How to use the File Format Doctor
Find out what a file really is from its first bytes, catch wrong extensions and disguised executables, and get offline conversion commands.
What it is for
"This file won't open" usually has a boring cause: the extension lies. An iPhone photo renamed to .jpg is still HEIC inside, a Word document saved as .zip is still a DOCX, and a download that stopped halfway is missing its end marker. File types are identified by their first bytes (the "magic number"), not by their name. This tool reads those bytes, compares them with 74 known formats, looks inside ZIP-based containers (DOCX, XLSX, ODT, EPUB, JAR, APK), and explains what's wrong, with commands for free offline tools to fix it.
It also flags the dangerous case: a program disguised as a document. It is not a virus scanner, though — it says what a file is, not whether it is malicious.
Worked example
You received IMG_0420.jpg from an iPhone and Windows won't open it. Paste the first bytes as hex (00 00 00 18 66 74 79 70 68 65 69 63 …) and the file name.
Result: HEIC image (HEIF with HEVC), high confidence, extension matches: no. The evidence is the ftyp box at offset 4 with the major brand heic. The diagnosis explains that programs pick an app by extension, so the file may fail to open; the expected extension is .heic. An info note adds that Windows Photos needs the HEIF and HEVC extensions from the Microsoft Store, and most browsers except Safari don't display HEIC.
The suggested fix:
mv IMG_0420.jpg IMG_0420.heic
magick IMG_0420.heic IMG_0420.jpg
The second command converts it to a real JPEG with ImageMagick 7, provided your build includes libheif.
A second check shows why the tool matters for safety: invoice_2026.pdf.exe starting with 4D 5A ("MZ") is detected as a Windows executable, with two critical findings — executable code, and a double extension designed to look like a PDF when Windows hides extensions. No conversion is offered.
How to read the result
- Detected and Confidence: what the bytes say the file is.
- Extension matches: whether the name agrees with the content.
- Encrypted: for ZIP-based files, whether entries are password-protected; "unknown" when there isn't enough data.
- Diagnosis lists findings by severity (critical, warning, info) with the byte-level Evidence.
- Safe offline conversions gives commands for LibreOffice, ImageMagick, FFmpeg, 7-Zip or iconv, already using your file name.
Tips and common mistakes
- Upload the file when you can (up to 10 MiB, analysed in memory, not stored). Only uploads can be checked for truncation, because the end of the file is needed.
- For hex input, 16 bytes identify most formats, but ZIP-based documents need 512 bytes or more so the entry names are visible. Get them with
xxd -l 512 fileor PowerShellFormat-Hex. - Rename first, convert second. Many problems disappear once the extension is right.
- Text files have no magic number. For them the tool checks encoding (BOM, UTF-16, UTF-8) and mojibake like
é, which means UTF-8 was read as Latin-1. - Never "fix" an unexpected executable by renaming it. Delete it, or ask the sender through another channel.
FAQ
Is this a virus scanner?
No. It identifies formats from bytes. A real PDF can still contain malicious content; use antivirus software for that.
Why does my .docx show up as ZIP?
DOCX, XLSX, PPTX, ODT and EPUB are ZIP archives. If too few bytes are given, only the ZIP layer is visible. Upload the file or paste more bytes.
How do I know if a download is incomplete?
Upload it. PDFs must end with %%EOF, PNGs with an IEND chunk, JPEGs with FF D9, and ZIPs need an end-of-central-directory record; a missing end marker is reported as truncation.
Can it repair a damaged file?
No. It tells you what's wrong and suggests conversions, but a truncated file is missing data that has to be downloaded again.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://fileformatdoctor.usefulweb.site/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://fileformatdoctor.usefulweb.site/mcp· tool namefile_format_doctor
Example request
curl -s -X POST https://fileformatdoctor.usefulweb.site/api/v1/calculate \
-H 'content-type: application/json' \
-d '{"filename":"IMG_0420.jpg","hexBytes":"00 00 00 18 66 74 79 70 68 65 69 63 00 00 00 00 6d 69 66 31 68 65 69 63"}'