How to Identify an Unknown File Type
Sometimes a file arrives without an extension, with a strange one, or with a name that does not match its contents. You can usually work out what it is.
1. Look at the extension
Start with the obvious. Check our list of file formats for the common ones. Make sure your system shows full extensions.
2. Check the magic bytes
Many formats begin with a fixed signature. You can see it in a hex editor or with the file command on Mac and Linux.
| Starts with | Format |
|---|---|
%PDF | |
PK | ZIP-based: DOCX, XLSX, PPTX, ODT, EPUB, JAR |
\x89PNG | PNG image |
\xFF\xD8\xFF | JPEG image |
GIF8 | GIF image |
ID3 | MP3 with tags |
RIFF | WAV, WebP or AVI |
3. Is it text?
Open it in a text viewer. Readable words suggest a text-based format such as JSON, XML, CSV or a log. Unreadable symbols suggest a binary format.
4. Try adding an extension
If you suspect a PDF, copy the file, add .pdf and open the copy. If you suspect an Office file, add .docx or .xlsx. If the file is that format, it will open.
5. Be careful
An unknown file might be harmful. Do not run it. Preview it in a browser and scan it with antivirus software. Our safety checklist explains more.