How to open a file with no extension

A download named 'attachment', a file called 'data', a recovered file with a number for a name. Here is how to find out what it is in under a minute, on any operating system, and what to do next.

how-todetectionfiles

A file with no extension is not a mystery, just a file whose name is not helping. The operating system uses the extension to pick an application; without one, double-clicking produces a shrug (“How do you want to open this file?”). The content is still there, and content is far more honest than a name anyway.

Step 1: find out what it actually is

You have three good options, in increasing order of effort.

In the browser, nothing to install. Drop the file on the detector. It reads the first bytes locally and reports the type, the MIME type, the confidence and the opening hex. Nothing is uploaded, so this is safe for files you would not want to send anywhere.

On macOS or Linux, the file command has done this job since 1973:

file ~/Downloads/attachment
# attachment: PDF document, version 1.7

file --mime-type ~/Downloads/attachment
# attachment: application/pdf

On Windows, PowerShell can show the first bytes, which you then compare against a signature table:

Format-Hex -Path .\attachment -Count 16
# 25 50 44 46 2D 31 2E 37 ...    %PDF-1.7

The first few bytes settle most cases on sight: %PDF is a PDF, PK is a ZIP (or a Word, Excel, PowerPoint or ODF document, which are ZIPs underneath), MZ is a Windows program, \x7fELF is a Linux one, \x89PNG and \xff\xd8\xff are PNG and JPEG, SQLite format 3 is a database.

Step 2: give it the right name

Once you know the type, rename the file to add the extension and the operating system will do the rest. On Windows, you need extensions visible first (File Explorer, View, Show, File name extensions), or the rename dialog will quietly produce attachment.pdf.txt.

If the file turns out to be a container, the extension still matters: a ZIP that is really a .docx opens in Word only if it is named .docx; renamed to .zip it opens as a folder of XML parts, which is correct and useless.

The usual suspects

In practice, extensionless files come from a handful of places, and each has a typical answer.

Email attachments and downloads named “attachment”, “file” or “download”. A server that did not know the type sent it as application/octet-stream, and the browser kept whatever name the server offered. Almost always a PDF, an image or an Office document.

Files from a phone backup, iCloud or Google Takeout. Often images (JPEG, HEIC, PNG) and videos (MP4, MOV) with numeric names. Photo managers import them fine once renamed, and most will detect the type themselves.

Recovered files from a damaged drive. Recovery tools name files by block number and guess types by signature; the guesses are usually right for photos and documents and wrong for anything exotic. Check each one before trusting it, and expect some to be fragments.

Files from Linux and macOS systems. Scripts, configuration and binaries routinely have no extension because those systems never needed one. A text file that starts #!/bin/bash is a shell script; one that starts with { is probably JSON; a binary starting \x7fELF is a Linux executable.

Files from software and games. Save games, caches and asset files are often custom formats with no public extension and no public structure. The detector will say “unknown” or guess a near match with low confidence, and that is the honest answer; the program that made the file is the only thing that reads it.

When the detector says “unknown”

Three possibilities, roughly in order of likelihood:

  1. It is a format outside the model’s catalogue. The model this site ships recognises 213 types. Proprietary game, database and application formats are mostly not among them.
  2. It is encrypted or compressed with no header. Random-looking bytes from the first byte onward usually mean encryption; the detector reports this as random data.
  3. It is a fragment. A piece of a larger file, cut off before its signature, or a file whose header has been overwritten.

For the first case, look at the readable strings inside the file (strings file | head on macOS and Linux) for a product name or a path. For the second, you need the key, and no tool will help without it.

What not to do

Do not rename an unknown file to .exe, .bat, .sh or .lnk and run it to “see what happens”. A file with no extension is exactly how a hostile executable arrives when a mail filter would have blocked .exe; the safety guide for executables covers the signs. Identify first, open second, and treat anything that turns out to be a program or a script from an unexpected source as untrusted.

The one-minute version

  1. Drop it on the detector or run file on it.
  2. Add the extension the result tells you.
  3. If it is a document, image, archive or media file, open it normally.
  4. If it is a program, a script, or “unknown” from an unknown source, stop and think about where it came from.