CruxDevCruxDev Tools Studio Prompts
file Utility • Zero-Server Privacy • 100% Client-Side

File Type Detector (Magic Bytes)

Identify what a file really is from its magic bytes: 80+ formats including Office, EPUB, archives, media, fonts and executables, with MIME type, expected extensions, mismatch warnings and a hex preview.

Overview

Identifies what a file really is by reading its magic bytes instead of trusting the extension. It recognises over 80 formats, including images, PDF, Word, Excel and PowerPoint files, OpenDocument, EPUB, archives, audio, video, fonts, executables and databases. Each result shows the MIME type, the usual extensions, a warning when the name does not match and a hex preview.

How It Works

Drop any number of files of any size. Only the first 64 KB of each one is read with the File API, so a multi-gigabyte video is checked as quickly as a small icon and nothing is uploaded. The results table lists the detected type, its MIME type, the extensions that format normally uses and the first 32 bytes in hexadecimal. A warning appears when the file name ends in an extension the detected format does not use, such as a PNG saved as photo.jpg. Copy the results or download them as a TSV report.

Step-by-Step Usage Guide

  1. Drop one or more files onto the page, or click to choose them.
  2. Read the detected type and MIME type for each file in the table.
  3. Look for a mismatch warning where the extension does not fit the content.
  4. Check the hex preview if you want to see the raw signature yourself.
  5. Copy the results or download the TSV report.

Technical Specifications & Standards

Most binary formats begin with a fixed signature: 89 50 4E 47 for PNG, 25 50 44 46 for PDF, 50 4B 03 04 for ZIP and 7F 45 4C 46 for ELF programs. Several common formats share a container, so the detector looks further. ZIP files are refined by reading the names in their local file headers, which separates DOCX, XLSX and PPTX by their word, xl and ppt folders, and APK and JAR by their manifests. OpenDocument and EPUB files are recognised from the uncompressed mimetype entry stored first. RIFF is split into WAV, AVI and WebP by its subtype, ISO base media files into MP4, MOV, M4A, HEIC and AVIF by their ftyp brand, and EBML into WebM or Matroska by doctype. Some signatures sit further in: TAR has ustar at byte 257 and ISO 9660 images have CD001 at 0x8001. Files with no signature are sniffed as text and classed as JSON, XML, SVG, HTML, CSV, PEM, a shebang script or plain UTF-8. Legacy DOC, XLS and PPT share one OLE2 header, so they are reported together.

Targeted Use Cases

  • Finding out what an email attachment with no extension actually contains.
  • Spotting an executable disguised with a .pdf or .jpg name before opening it.
  • Checking that a batch of uploads really are JPEG and PNG images.
  • Telling a DOCX apart from a plain ZIP or a legacy DOC file.
  • Identifying recovered files whose names were lost after a disk failure.

Notes & Gotchas

  • Treat a mismatch warning on an attachment as a reason to stop and check where it came from.
  • Remember that text formats such as CSV and JSON have no signature, so their detection is an informed guess.
  • Rename a file to its expected extension when the detected type is certain and the program refuses to open it.

Frequently Asked Questions

What are magic bytes?

They are a short, fixed sequence at the start of a file that marks its format, such as %PDF for PDF documents or PK for ZIP archives. Programs check them because a file name can be changed freely.

Is it safe to check large or suspicious files here?

Yes. The tool reads only the first 64 KB as raw bytes and never runs, opens or renders the file. Everything happens locally, so the file is not sent anywhere.

Why is my DOCX shown as an Office Open XML package?

That label appears when the [Content_Types].xml entry is found but the word, xl or ppt folder starts beyond the first 64 KB. The file is still a valid Office document of one of those types.

Can it tell a DOC file from an XLS file?

Not reliably. Legacy Word, Excel and PowerPoint files use the same OLE2 compound file header, so they are reported together as a legacy Office document.

Does it change or rename my files?

No. It only reads bytes and reports what it finds. If the extension is wrong, rename the file yourself using one of the expected extensions shown.

Related tools

  • MIME Type Lookup - Search file extensions to find MIME types and vice versa — covers 800+ registered IANA media types with descriptions.
  • Hex Dump / Hex Editor - View and edit file bytes as hexadecimal with ASCII sidebar, offset navigation, byte search, and binary diff highlighting.
  • EXIF Viewer & Remover - Inspect photo metadata - camera make and model, date taken, GPS - and download a clean copy with all EXIF data stripped.
  • ZIP File Opener & Creator - Open a .zip in the browser to browse its folder tree with sizes, preview text and images, and extract one file or all of them. Or create a new ZIP from dropped files with a chosen compression level.
  • Hash Type Identifier - Identify which algorithm produced a hash - MD5, SHA-1, SHA-256, SHA-512, bcrypt, Argon2, crypt formats, NTLM, CRC32 and more - from its length, alphabet and prefix.
  • ENV File Validator - Validate .env files for missing keys, duplicate entries, and empty values. Compare local vs example.