A binary file stores data as ones and zeros that only a specific program knows how to read

A binary file is any file your computer stores as raw machine code — long strings of 1s and 0s — rather than as readable text. When you open a binary file in a text editor, you see garbage: symbols, random characters, or nothing at all. That is because the file was never meant to be read as text. Instead, a specific program (like Photoshop for image files, or Excel for spreadsheet files) knows how to translate those 1s and 0s into something you can see and use.

The opposite is a text file — one where the data is stored as characters you can read directly. A .txt file, a .csv file, or the HTML code behind a web page are all text files. You can open them in any text editor and see actual words and numbers.

This distinction matters when you convert files, because some conversions are straightforward (text to text) and some require the right tool to decode the binary format first.

Key Takeaways

  • Binary files store data as machine code that only their native program can decode, while text files store readable characters.
  • Opening a binary file in a text editor shows garbage because the program does not know how to translate the 1s and 0s.
  • Common binary file types include .jpg, .png, .exe, .pdf, .docx, and .mp3 — each with its own format that a specific program understands.
  • When converting a binary file, you need the original program or a converter that understands that specific binary format.

How a computer reads binary files differently

When you double-click a file on your computer, the operating system looks at the file extension (.jpg, .docx, .mp3) and opens it with the program associated with that type. That program reads the binary code and translates it into something you can see — an image, a document, a song.

If you try to open that same file in Notepad or another text editor, the program tries to read the 1s and 0s as if they were text characters. Since binary code is not arranged as readable text, you get nonsense on screen. The data is still there and unchanged; the program just does not know how to interpret it.

This is why you cannot straightforward rename a .jpg file to .txt and expect to read it. The file format — the way the data is actually arranged inside — has not changed. Only the label has.

Common binary file types you encounter

Most files you use every day are binary. Image files (.jpg, .png, .gif, .bmp) are binary — they store pixel color information as machine code. Microsoft Word documents (.docx), Excel spreadsheets (.xlsx), and PDFs are all binary formats, even though they contain text you can read. Audio files (.mp3, .wav, .flac) and video files (.mp4, .mov, .avi) are binary. Executable programs (.exe on Windows, .app on Mac) are binary.

The only files that are purely text are those with extensions like .txt, .csv, .html, .xml, .json, and .log. You can open any of these in a basic text editor and read the content directly.

Some file types blur the line. A .docx file, for example, is actually a compressed folder of XML files (which are text-based), but the whole package is treated as binary because you need Microsoft Word or a compatible program to open it properly.

Why binary format matters for file conversion

When you convert a file from one format to another, the program doing the conversion has to read the original binary code, understand what it means, and write it out in a new format. This is why you cannot convert a .jpg to a .docx by just changing the extension — the data inside is completely different, and no straightforward relabeling will make sense of it.

Some conversions are straightforward because the formats are similar. Converting a .jpg to a .png (both image formats) is fast because both store pixel data; the program just rewrites it in PNG's structure instead of JPEG's. Converting a .docx to a .pdf is also common because many programs understand both formats.

Other conversions are impossible or require data loss. You cannot meaningfully convert an audio file (.mp3) to an image format (.jpg) because they store completely different kinds of information. You can convert a .docx to a .txt, but you will lose all formatting, images, and layout because plain text cannot store those things.

Text files versus binary files in conversion tools

When you use a file converter, the tool needs to understand the binary structure of the original file. Some converters are built into Windows or Mac (like the ability to save a Word document as PDF). Others are standalone programs like Handbrake (for video), ImageMagick (for images), or FFmpeg (for audio and video).

For text-based conversions — like turning a .csv into a .json — the process is simpler because both formats are text-based. The converter just needs to rearrange the text according to the new format's rules. For binary conversions, the converter has to decode the original binary format, extract the actual data, and encode it in the new binary format.

This is why some conversions are fast and others take time. A .jpg to .png conversion might take seconds. A large video file conversion from .mp4 to .avi might take minutes or hours, because the program has to read and rewrite a lot of binary data.

When you need the original program to convert

Some binary formats are proprietary — owned and controlled by a company — and only that company's program can read them properly. Adobe Photoshop's native format (.psd) is proprietary; Photoshop is the only program that fully understands its binary structure. If you want to convert a .psd to a .jpg, you need either Photoshop itself or a third-party tool that has reverse-engineered the .psd format.

Microsoft Office formats (.docx, .xlsx, .pptx) are technically open standards, but they are complex enough that not every program reads them perfectly. If you need a perfect conversion, using the original Microsoft program is most reliable.

For common formats like .jpg, .mp3, and .pdf, many converters exist because the formats are well-documented and widely supported. For obscure or proprietary formats, your options are limited to the original program or specialized converters that cost money.

How to tell if a file is binary or text

On Windows, right-click a file and choose "Open with" and then "Notepad". If you see readable text, it is a text file. If you see symbols, random characters, or nothing, it is binary. On Mac, you can open a file with TextEdit and check the same way.

You can also look at the file extension. If it is .txt, .csv, .html, .xml, .json, .log, or .sh, it is almost certainly text. If it is .jpg, .png, .mp3, .mp4, .exe, .pdf, .docx, or .xlsx, it is binary.

The file extension is just a label, though. A file's actual format is determined by the data inside. Renaming a .jpg to .txt does not change what is inside; it just confuses your operating system about which program should open it.

Frequently Asked Questions

Can I convert any binary file to any other format?

No. You can only convert between formats that store compatible types of information. You can convert an image to a different image format, or a video to a different video format. You cannot convert an image to audio, or a spreadsheet to a video, because the data types are fundamentally different. Some conversions also cause data loss — converting a .docx to .txt removes all formatting.

Why does my file look like garbage when I open it in Notepad?

Because Notepad is a text editor and your file is binary. The program is trying to read machine code as if it were text characters, which produces nonsense. Always open binary files with the program designed for that format — Photoshop for .psd, Excel for .xlsx, and so on.

If I rename a .jpg file to .txt, does it become a text file?

No. Renaming only changes the label; it does not change the data inside. The file is still binary image data. Your computer will be confused about which program to use, and if you force it open in a text editor, you will see garbage. The file itself is unchanged.

What is the difference between a .docx and a .txt version of the same document?

.docx is binary and stores formatting, fonts, images, and layout. .txt is plain text and stores only the words, with no formatting at all. Converting .docx to .txt removes everything except the raw text. Converting .txt to .docx creates a document with no formatting applied.

Do I need special software to convert binary files?

It depends on the format. For common types like images and videos, free converters are available online or built into your operating system. For proprietary formats like Adobe .psd files, you usually need the original program or a paid third-party converter. Always check whether a converter supports the specific format you are working with before you start.