How to View a Binary File (BIN, DAT and Unknown Files)
By SimpleTools24Published 4 min read
To view a binary file, open it in a hex viewer, which shows each byte as a two-digit hexadecimal number alongside any readable text. Built-in commands do this on every operating system (xxd or hexdump on macOS and Linux, Format-Hex in Windows PowerShell), and a browser-based binary file viewer does it without a terminal. Opening a binary file in a normal text editor only shows garbled symbols, because most of its bytes aren't meant to be characters.
In this guide
What "Viewing" a Binary File Can Tell You
A binary file, such as a .bin firmware image, a .dat file from an app, or a download with no extension, is just a sequence of bytes. Looking at those bytes can answer practical questions:
- What type of file is it? Most formats start with a recognisable signature, covered in file signatures and magic numbers.
- Does it contain readable text? Names, version numbers, URLs and error messages are often embedded as plain strings.
- Is it damaged or empty? A file full of
00bytes, or one that ends abruptly, tells you something went wrong. - Did it change? Comparing two versions byte by byte shows exactly what differs.
What a viewer can't do is make sense of a proprietary format for you. You'll see the raw structure, not a rendered document.
View a Binary File With Built-In Commands
macOS and Linux: xxd
xxd firmware.bin | head -n 20Each output line shows an offset, sixteen bytes in hex, and their ASCII representation. xxd comes with the Vim package, which is installed on most systems.
macOS and Linux: hexdump
hexdump -C firmware.bin | head -n 20The -C flag gives the canonical layout: offset, hex bytes and an ASCII column between | bars.
Windows: Format-Hex
Format-Hex -Path .\firmware.bin | Select-Object -First 20Format-Hex is built into PowerShell. On older Windows versions, certutil -dump file.bin also prints a hex dump.
Extract Readable Text With strings
strings -n 6 firmware.bin | lessstrings prints runs of printable characters at least six characters long (the -n value). It's a quick way to spot version numbers, copyright notices or paths inside an executable. On Windows, Microsoft's Sysinternals suite includes a strings tool.
View a Binary File in Your Browser
If you'd rather not use the command line, you can open a binary file in an online viewer. It has several views of the same bytes:
- Hex: the classic layout with offsets, hex bytes and an ASCII column.
- ASCII: the bytes as characters, with non-printable bytes shown as dots.
- Binary: each byte as eight 0s and 1s, useful for bit flags.
- Strings: readable text runs pulled out of the file.
- File info: size, checksums and a signature check that suggests the file type when it recognises one.
You can search for text or hex byte sequences, jump to an offset, compare two files, and export a hex dump or the strings list. Files up to 64 MB are read and analysed in your browser, so the file isn't uploaded to a server.
Reading What You See
The first time you look at a hex dump it can look like noise. A few patterns help:
- The first 4 to 16 bytes usually identify the format.
89 50 4E 47is a PNG;50 4B 03 04is a ZIP (which includes DOCX, XLSX and APK files). - Long runs of
00are padding or empty space. - Readable text in the ASCII column often marks headers, metadata or embedded messages.
- Repeating patterns may be a table of fixed-size records.
How to read a hex dump walks through a real example line by line.
Common Binary File Types You Might Be Holding
| Extension | Usually contains | How to check |
|---|---|---|
| .bin | Firmware, disc image, game data, or anything raw | Look for a signature at offset 0 |
| .dat | Application data in a program-specific format | Look for embedded strings naming the app |
| No extension | Could be anything, often a download missing its name | Signature check, then rename |
| .dcm | Medical image in DICOM format | "DICM" appears at byte offset 128 |
| .exe / .dll | Windows program | Starts with "MZ" (4D 5A) |
If a file turns out to be a known format, open it with the right application. A DICOM scan, for instance, is easier to inspect in a DICOM viewer than as raw bytes.
Binary or Text?
Some files with odd extensions are actually text: logs, configuration files, CSV exports. If the ASCII column of a hex view reads like sentences with 0A bytes (line feeds) scattered through it, you're looking at text, and a text viewer will serve you better. Binary vs text files explains the difference. For very large text files, a large file viewer is the right tool.
Frequently Asked Questions
Can I open a .bin file without special software?
Yes. Any hex viewer shows its contents, including the built-in commands above or a browser-based viewer. Whether you can use the data depends on what the file is.
Why does Notepad show strange characters?
Notepad tries to interpret every byte as a character. Bytes that aren't valid text appear as symbols, boxes or nothing at all.
Is it safe to view an unknown binary file?
Viewing bytes in a hex viewer doesn't execute anything, so it's safe. The risk comes from running or opening the file in an application that executes or parses it.
Can I edit a binary file in a viewer?
A viewer is read-only. To change bytes you need a hex editor, and you should always work on a copy.
Summary
A hex viewer is the universal way to look inside any file. Use xxd, hexdump or Format-Hex if you're comfortable in a terminal, or a browser-based viewer for hex, strings, search and file-type detection without installing anything.
Related tools
Related articles
- How to Read a Hex DumpA line-by-line walkthrough of offsets, hex bytes, the ASCII column and little-endian numbers.
- File Signatures and Magic NumbersHow magic numbers identify files regardless of extension, with a reference list of common signatures.
- Binary vs Text FilesHow encodings, line endings and null bytes separate text from binary data, and why tools care.