How-to

How to Open an Unknown File: By Extension and Signature

You found a file on an old drive with a baffling extension — or no extension at all. Double-clicking does nothing, Windows asks you to "choose a program," and you have no idea which. Don't guess: files carry a "fingerprint" in their first bytes that tells you the exact format. Here's how to read it — even with zero technical background.

A person sorting through unknown files on a laptop, an external drive nearby
Every file has a hidden "signature" at the start — that's how the format is identified. Photo: Pexels

Step 1: look at the extension

An extension is the letters after the dot in a filename: photo.jpg, report.pdf, archive.zip. It's exactly what the operating system uses to decide which program opens the file. That's the first thing to check.

The catch is that in Windows extensions are often hidden by default. To see them, open the "View" tab in File Explorer and enable "File name extensions." You may discover the file isn't "extensionless" at all — the extension was just hidden.

But the extension has a weak spot: it's just text in the name, easy to change by hand or lose in transit. You can rename picture.png to picture.txt — the contents don't change, but the system gets confused. So the extension is a hint, not the final word.

The key idea

An extension can be faked; the file's contents can't. The true format is always baked into the file's first bytes. That's the reliable way to identify it.

Step 2: read the signature (magic bytes)

Nearly every file format begins with a unique sequence of bytes — called the signature, or "magic bytes" (magic number). Think of it as a barcode at the very start of the file. Programs read those bytes and know what they're dealing with — regardless of the extension in the name.

The most famous examples are easy to remember: every PNG starts with the bytes 89 50 4E 47 (where 50 4E 47 spells "PNG"). Every JPEG starts with FF D8 FF. Every PDF starts with the characters %PDF. And a ZIP archive (plus everything ZIP-based: docx, xlsx, jar) starts with PK — the initials of the format's creator, Phil Katz.

Analyzing a file on a Dell laptop — identifying the type by content
Reading just the first few bytes of a file is enough to learn its real format. Photo: Pexels

Signature table for popular formats

Here's a cheat sheet for the most common formats. On the left are the bytes in hexadecimal (as a hex editor shows them); on the right is how they read as text. Almost all sit at the very start of the file (offset 0):

FormatSignature (hex)Text
PNG89 50 4E 47‰PNG
JPEGFF D8 FF
GIF47 49 46 38GIF8
PDF25 50 44 46%PDF
ZIP / DOCX50 4B 03 04PK..
RAR52 61 72 21Rar!
7z37 7A BC AF7z..
PSD38 42 50 538BPS
XCF (GIMP)67 69 6D 70gimp
EPS / PostScript25 21 50 53%!PS

The MP4 trick (and others)

Not all signatures sit at the very start. In an MP4 video, the ftyp marker is at offset 4, not 0. That's why online detectors read the first few dozen bytes rather than just the first three.

How to view a file's first bytes

To see the signature with your own eyes, you need a hex editor — a program that shows a file's contents as raw bytes. It's simpler than it sounds:

1

Open a hex editor

Free options: HxD (Windows), in-browser online hex viewers, or — if you're comfortable with it — the built-in xxd command on a Mac. The easier options above work for everyone.

2

Drag in the file

The editor shows the contents: bytes in hex on the left, their text representation on the right.

3

Look at the first line

Compare the first 3–4 bytes with the table above. A match is the real format.

If you see readable text at the start like %PDF or GIF8, the format is obvious. If the first bytes match FF D8 FF, you have a JPEG photo — whatever the file is named.

The extension is the sign on the door. The signature is what's actually inside the room. Trust the contents.

Online format detectors

If you'd rather not bother with a hex editor, there's an even easier route — online signature detectors. You upload the file, the service reads its first bytes, compares them with a large database of known signatures, and reports the real type. No technical knowledge needed — you get a result in a second.

They're handy too because such services know hundreds of formats, including rare ones that are hard to identify by hand. In effect they automate exactly what you'd do in a hex editor.

Safety: what to watch out for

Before opening an unknown file with a double-click — identify its type. That's not paranoia, it's common sense, especially if the file came from an untrusted source.

Dangerous extensions

Be especially wary of .exe, .scr, .bat, .cmd, .js, .vbs — these are executables and scripts that can contain malicious code. Images, documents and archives are relatively safe, but a file from an untrusted source is best run through antivirus. And remember: malware can disguise itself as an image by changing the extension — so checking the signature also protects you from spoofing.

What to do after identifying it

You've learned the format — great. The rest is easy. If the extension was wrong or missing, rename the file with the correct extension (e.g. .png or .pdf), and it'll open in the right program.

If the format turns out to be exotic and you don't have the right program handy, the most universal route is to convert the file into a familiar format. An image — to PNG or JPG, and any viewer will show it. A document — to PDF. That saves you hunting down and installing special software.

Top-down view of working with files and photos on a laptop
Once you know the format — rename the file or convert it to something familiar. Photo: Pexels

Found it's an image? Open it in one click

The FormatZ converter accepts dozens of graphics formats and saves them as a plain PNG or JPG — right in your browser, no install. See the full list of supported formats.

Browse all formats

If it turns out to be a designer file — PSD, EPS or XCF — see our guide "How to open designer files." And the specific converters are right here: PSD to PNG, EPS to PNG and SVG to PNG.

Identify the format by its signature — the file's first bytes (magic bytes). Open the file in a hex editor or upload it to an online signature detector: it reads the header and tells you the real type. Then add the correct extension and open it with the right program.
They are a few bytes at the very start of a file that programs use to identify its format — regardless of the extension. For example, every PNG starts with the bytes 89 50 4E 47, every JPEG with FF D8 FF, and every PDF with the characters %PDF. This is more reliable than the extension, which is easy to change by hand.
Yes. There are online detector services: you upload the file, the service reads its first bytes and compares them against a database of known signatures, then reports the real type. It is the fastest way for anyone who doesn't want to fiddle with a hex editor.
Identify the type first, without double-clicking the file. Be especially careful with .exe, .scr, .bat and .js extensions — these are executables that can contain malicious code. Images, documents and archives are relatively safe, but a file from an untrusted source is best scanned with antivirus.
Add the correct extension (e.g. .png or .jpg) and open it in a viewer. If the format is exotic and won't open, convert it to a plain PNG or JPG — then any program will display it.