How ViewAnyFile Identifies Files — Magic Bytes
Ever received a mystery file with no extension? Learn how ViewAnyFile.app uses magic byte detection, MIME analysis, and a 377+ format database to identify any file.
Quick Answer: Ever received a mystery file with no extension? Learn how ViewAnyFile.app uses magic byte detection, MIME analysis, and a 377+ format database to identify any file.
You receive a file called report.dat. Or maybe attachment — no extension at all. What is it? A PDF? An image? A database? Most tools give up here. ViewAnyFile.app doesn't.
The Problem With File Extensions
File extensions (.pdf, .docx, .jpg) are just hints. They can be:
- Missing — many email attachments strip extensions
- Wrong — a PDF renamed to .txt, an image saved as .dat
- Ambiguous — .xml could be an SVG, a config file, or a spreadsheet
Relying only on extensions is unreliable. That's why ViewAnyFile.app uses a multi-layered detection system.
Layer 1: Extension Matching
First, we check the file extension against our database of 377+ known formats. This handles the majority of files instantly — a .pdf file is almost always a PDF.
Layer 2: Magic Byte Analysis
This is where it gets interesting. Every file format has a unique signature in its first few bytes — called "magic bytes" or "file signatures":
- PDF files start with
%PDF- - PNG images start with
\x89PNG - ZIP archives start with
PK(Phil Katz's initials, the ZIP inventor) - JPEG images start with
\xFF\xD8\xFF - Blender files start with
BLENDER - SQLite databases start with
SQLite format 3
ViewAnyFile.app reads these bytes locally in your browser — no server needed — and identifies the true format regardless of the file name.
Layer 3: MIME Type Cross-Check
Browsers provide their own MIME type detection. We cross-reference this with our magic byte analysis. If the browser says application/octet-stream but our bytes say PDF, we trust our detection.
Layer 4: Smart Viewer Routing
Once identified, we route your file to the best viewer engine:
- pdf.js for PDF documents
- Three.js for 3D models (STL, OBJ, GLTF, FBX)
- CodeMirror for source code (50+ languages)
- web-ifc for IFC BIM models (WebAssembly)
- Canvas for images (including RAW, HEIC, TIFF)
- WASM CAD engine for DWG, STEP, IGES files
Why This Matters
IT professionals, helpdesk teams, and anyone who receives unknown files will appreciate not having to guess. ViewAnyFile.app tells you exactly what a file is — and opens it — in seconds.