# File Type Identifier

> Identify a file's real type from its magic numbers: true format vs extension, MIME type, container-aware detection (docx/apk/jar are ZIPs). Nothing uploaded.

- URL: https://bytescope.dev/en/file-type/
- Locale: en · Also: [ja](https://bytescope.dev/ja/file-type.md) · [zh-Hant](https://bytescope.dev/zh-Hant/file-type.md)
- Runs: Your files never leave your browser — all processing is local.
- Requires: Any modern browser (Chrome, Edge, Firefox, Safari), desktop and mobile.
- Updated: 2026-09-08

## What it does

Drop any file — especially one with a missing, wrong or unknown extension — and this tool reads its first bytes (and, where needed, its tail) to identify the real format from magic-number signatures. You get the detected type, its MIME type, the correct extension, and a one-line explanation of what the format actually is. Everything runs in your browser; files are never uploaded, so it's safe for files you don't trust.

Extensions lie, and that's the point of this tool: a `.jpg` that is actually a PNG, an `.exe` hiding inside a renamed document, or a mystery download with no extension at all. When the detected type doesn't match the extension, the mismatch is flagged prominently with the suggested correct name. Container formats get a second look — docx, xlsx, pptx, apk, jar and epub are all ZIP files inside, so the tool opens the container's directory to tell them apart, and does the same for the RIFF family (WAV, AVI, WebP).

Text files get their own analysis: encoding (UTF-8/16, BOM presence), line endings (LF vs CRLF), and whether stray NUL bytes suggest binary contamination. Batch mode identifies many files at once, and anything unidentifiable shows its first 64 bytes as hex with a one-click jump into the Hex Editor for manual inspection.

## Limits

Does not open, convert or repair the file; it identifies the real format from the magic bytes.

## Machine output

Copy JSON copies an envelope `{ tool, url, generatedAt, userAgentHint, result }`. `tool` is `"file-type"`; `result` is the magic-byte identification below. The file name and any leftover file bytes (hex dump) are omitted.

- `identified` (boolean) — `false` = no detector matched (unidentified). `true` = a detector matched a known format. There is no "unknown format" id.
- `formatId` (string | null) — Stable format id (e.g. `"png"`). `null` = unidentified.
- `formatName` (string | null) — Display name. `null` = unidentified.
- `mime` (string | null) — Detected MIME type. `null` = unidentified.
- `extensions` (string[]) — Canonical extensions without a leading dot, on-screen order. Empty when unidentified or the type has none.
- `description` (string | null) — One-line format description. `null` = unidentified.
- `confidence` (string | null) — `"certain"` | `"likely"` | `"weak"`. `null` = unidentified.
- `extensionStatus` (string) — `"match"` | `"mismatch"` | `"no-extension"` | `"unknown"`.
- `extensionActual` (string | null) — Lowercase extension from the name, no dot. `null` = the name had no extension.
- `suggestedExtension` (string | null) — Canonical extension to rename to. `null` unless status is `"mismatch"`.
- `isDangerousMismatch` (boolean) — Executable content with a mismatched extension.
- `textEncoding` (string | null) — `"utf-8"` | `"utf-8-bom"` | `"utf-16le-bom"` | `"utf-16be-bom"` | `"ascii"` | `"unknown-binary"`. `null` = not classified as text, so encoding was not analysed. `"unknown-binary"` = analysed, charset unnamed.
- `lineEndings` (string | null) — `"lf"` | `"crlf"` | `"cr"` | `"mixed"` | `"none"`. `null` = not analysed.
- `hasNulBytes` (boolean | null) — `null` = not analysed; `false` = analysed, no NUL; `true` = NULs present.
- `byteLength` (number | null) — File size in bytes. `null` = size was not supplied.

## FAQ

### Is my file uploaded to identify it?

No. Only the first few kilobytes (and for some container formats, the tail) are read locally in your browser to match against the signature database. The file never leaves your device — which is exactly what you want when checking a suspicious file.

### What is a magic number?

Most file formats begin with a fixed byte signature — PNG files start with 89 50 4E 47, ZIP archives with 50 4B. These "magic numbers" identify the real format regardless of the filename, which is how this tool (and the Unix `file` command) can catch a mislabeled file.

### Why does my .docx show up as a ZIP file?

Because it is one — docx, xlsx, pptx, apk, jar and epub are all ZIP containers with specific contents. The tool looks inside the ZIP directory for telltale entries ([Content_Types].xml for Office, AndroidManifest.xml for APK) to report the specific format, not just "ZIP".

### Can it tell me if a file is dangerous?

It can catch the common disguise trick — an executable renamed to look like a document — by revealing the true type. That's a useful first check, but it is not malware scanning: a genuinely-typed file can still contain malicious content.

### What if the file can't be identified?

Unknown files show their first 64 bytes as hex so you can inspect the structure yourself, with a one-click handoff to the Hex Editor. Signatures are added over time, so unidentified formats are also a signal for us to extend the database.
