File Type Detector

Got a file with the wrong name, no name, or a name you do not trust? Drop it here. The page reads the first bytes, names the real format, and shows its evidence: which bytes matched, at which offset, and what the extension claimed instead.

File signature inspector

Reads 64 KB from each end of a file. Nothing is uploaded.

No files yet. Each file gets its own card here, in the order you added them.

    The extension is a sticky note. The first bytes are the file.

    Rename holiday.png to holiday.jpg and nothing inside changes. Windows picks a new icon, the browser reports image/jpeg, and an upload form checking only the name lets the file through. The pixels still sit in a PNG container, opening with the same eight bytes every PNG has carried since the format was published in 1996: 89 50 4E 47 0D 0A 1A 0A.

    Those leading bytes are the file signature, also called the magic number. Format designers put them there on purpose, so a program has a fixed marker to test before parsing anything. The Unix file command and its libmagic database work this way, and so does this page, inside your browser tab.

    Every card puts two claims next to each other. On the left, what the name says. On the right, what the bytes say, with the exact bytes and offsets behind the call. You check the reasoning yourself instead of trusting a badge.

    Why the browser MIME type is wrong so often

    The type your browser reports for a picked file comes from the extension, looked up in the operating system or a built-in table. The browser never opens the file to confirm. Rename a file and its MIME type changes with the name. Server code trusting the Content-Type header of an upload inherits the same blind spot, since the browser filled in the header from the same lookup.

    Reading a signature by hand

    Signatures are short, and many spell out ASCII on purpose. A PDF opens with %PDF-. A ZIP opens with PK, the initials of Phil Katz, who wrote PKZIP. A Windows program opens with MZ, after Mark Zbikowski, one of the MS-DOS engineers. Not every signature sits at byte zero, which is why the offset column matters.

    Signatures worth knowing on sight
    FormatOffsetBytes (hex)As text
    PNG089 50 4E 47 0D 0A 1A 0A.PNG....
    JPEG0FF D8 FF...
    GIF047 49 46 38 39 61GIF89a
    PDF025 50 44 46 2D%PDF-
    ZIP, DOCX, XLSX, JAR, APK050 4B 03 04PK..
    Windows EXE and DLL04D 5AMZ
    Linux ELF binary07F 45 4C 46.ELF
    MP4, MOV, HEIC, AVIF466 74 79 70ftyp
    SQLite database053 51 4C 69 74 65 20 66SQLite f
    tar archive25775 73 74 61 72ustar
    ISO 9660 disc image3276943 44 30 30 31CD001

    The PNG signature is the clever one. The 0D 0A pair and the lone 0A break if a transfer rewrites line endings. The high byte 89 breaks if a channel strips the eighth bit. 1A stops the old DOS type command from printing binary to the screen. A mangled PNG fails at the first eight bytes instead of halfway through decoding.

    One signature, many formats

    The hard cases are formats built inside someone else's container. A signature match only names the container. Telling the members apart means reading further into the file, and the page does so for the families below. The evidence line on each card switches from "Signature match" to "Signature + structure" when this deeper read decides the answer.

    Text files have no magic number

    JSON, CSV, HTML, Python and plain notes start with whatever character the author typed first. No signature exists, so for text the page stops matching and starts reasoning. The evidence label changes to "Text heuristic" to say so.

    1. Encoding first. A byte order mark settles encoding: EF BB BF for UTF-8, FF FE or FE FF for UTF-16. Without one, the sample has to decode as UTF-8 with no NUL bytes and almost no control characters to count as text at all.
    2. Shape second. A leading { or [ triggers a real JSON parse for files up to 5 MB. A #! line names the interpreter. <svg, <html and <?xml point at markup. -----BEGIN marks PEM keys and certificates. An identical count of commas, tabs or semicolons across the first lines reads as CSV or TSV.
    3. Everything else is plain text. A .md, .log or .yml file landing here counts as a match. Text has no wrong extension unless the content has a stronger identity.

    Text cards also report line endings. A file mixing CRLF and LF lines is a common reason two copies of the same document hash differently.

    The CSV check is the weakest test on the page. A quoted field holding a comma throws the column count off, so a real CSV full of street addresses sometimes lands as plain text. Treat a text verdict as a strong hint, not a ruling.

    Reading a result card

    Load sample files drops six made-up files on the page, each built to land on a different verdict:

    Open the hex dump on any card to see the bytes the verdict rests on, highlighted in place. For formats with a signature past byte 64, such as tar, the dump adds the row holding the match.

    When a mismatch matters

    Most mismatches are harmless. A phone saving HEIC under a .jpg name. A reporting tool exporting HTML with an .xls name so Excel opens it. A CSV download holding JSON. Those cards stay amber.

    Red is reserved for executable content under a non-executable name, and for double extensions such as report.pdf.exe. Windows hides known extensions by default, so the second one displays as report.pdf with a PDF-looking icon if the attacker embedded one.

    If you run an upload form, check content on the server as well. A check in the browser protects the visitor, and an attacker skips the browser by posting straight to your endpoint. In PHP, the fileinfo extension reads the same signatures:

    $finfo = new finfo(FILEINFO_MIME_TYPE);
    $mime = $finfo->file($_FILES['upload']['tmp_name']);
    
    if (!in_array($mime, ['image/png', 'image/jpeg', 'image/webp'], true)) {
        http_response_code(415);
        exit;
    }

    From a shell, file --mime-type upload.bin answers the same question. Signature checks stop renamed files. Polyglots get past them: a file built to be a valid GIF and a valid JAR at once passes a GIF test. For image uploads, re-encoding on the server removes the whole class of problem, and header checks alone do not.

    Where this page stops

    When you need the full metadata of one known file rather than its identity, the File Metadata Extractor goes deeper. To confirm two files with the same detected type hold the same bytes, hash both in the File Hash Calculator.

    Questions people ask about mystery files

    Short answers for the moments after a card comes back amber or red.

    Is my file uploaded anywhere?

    No. The page reads slices of the file with the browser File API, at most 64 KB from the front and 64 KB from the back, plus a ZIP or OLE directory when a container needs a closer look. No network request carries file data.

    Why does my browser say image/jpeg when the card says PNG?

    The browser MIME type comes from the extension, not the content. Name a PNG photo.jpg and the browser reports image/jpeg without reading a byte. The card reads the bytes, which is why the two disagree.

    Should I rename the file to the suggested extension?

    For an amber card, yes. Renaming fixes apps refusing to open the file or opening the wrong program. Renaming does not convert anything though, so a PNG renamed to .png is still the same PNG. If you need a different format, run the file through a converter.

    My .docx shows as related to ZIP, or my .zip shows as DOCX. Is the file broken?

    No. DOCX is a ZIP archive with a fixed folder layout inside. A blue card means the name and content agree on the container and the content is more specific. Word expects .docx, an unzip tool accepts either.

    What does the entropy number mean?

    Byte entropy measures how evenly the 256 byte values are spread across the sample, from 0 to 8 bits per byte. Plain text sits around 4 to 5. Executables land near 5 to 6.5. Compressed and encrypted data sits close to 8. On an unknown file, a value near 8 is the strongest clue you will get.

    Why is an old Excel file labelled OLE compound file instead of XLS?

    The page found the OLE signature but no Workbook stream in the first directory sector. This happens with files written by unusual tools, damaged files, and formats such as Microsoft Project plans whose streams are not in the lookup. The verdict stays green because .xls is one of the names an OLE file legitimately carries. Open the file in Excel to settle it.

    A file with no extension came back as an ELF executable marked green. Why green?

    Linux and macOS programs normally have no extension, so a missing extension on an ELF or Mach-O binary is expected. The red verdict only fires when program content sits behind a document, image or media name.