Safekipedia

Binary file

Adapted from Wikipedia · Discoverer experience

A binary file is a type of computer file that is different from a text file. While text files contain letters, numbers, and symbols that we can read directly, binary files are made up of a special kind of code that computers understand. These files often hold information that cannot be shown as simple text, like pictures, music, or complex documents.

Many binary file formats include some text mixed in with their data. For example, some older computer document files, such as older Microsoft Word document files, have the words of a document stored as text, but they also include extra parts that tell the computer how the text should look — like bold or underlined words. These extra parts are stored in binary form.

Binary files are important because they let computers store and work with many kinds of information that text alone cannot handle. Whether it’s a photo, a video, or a program, these files help computers process and show data in many useful ways.

Background and terminology

All modern computers store information using tiny units called bits (binary digits), following a system known as binary code. Because of this, every piece of data on a computer can be thought of as "binary."

One common type of file contains text, which is made possible through a special system called a character encoding. These are known as "text files." Files that are not like this are called "binary files."

Sometimes, "text files" might include parts that are actually binary data, and many "binary files" have parts that look like text. These mixed files are usually treated as "binary" because a program that only understands text wouldn’t know how to handle them properly.

Structure

Binary files are usually thought of as a series of small groups of numbers called bytes. These bytes are made from eight bits, which are the basic building blocks of digital information. Binary files are not meant to be read like a storybook; instead, they hold things like pictures, sounds, or programs that your computer can use.

Some binary files have special parts called headers that help the computer understand what’s inside. For example, a picture file might start with a code like GIF87a to show that it’s a GIF image. If a file doesn’t have these special parts, it might be called a flat binary file. Sometimes, binary files need to be changed so they can travel over the internet safely, using codes like Base64.

Manipulation

Sometimes, we need to send binary files through systems like email that can't handle all types of data. To do this, the file is changed into plain text using methods like Base64. This makes the file a bit bigger—about 30% larger—but it can be turned back into the original file after it is received.

Both Microsoft Windows and Unix-like systems let programmers choose if a file is plain text or a binary file when they open it. This choice helps the system handle special characters correctly, like those that show the end of a line, which look different on each type of system.

Viewing

You can use a special tool called a hex editor to look at a binary file. This tool shows the file’s data as a series of numbers or characters, helping you see what the file really contains.

If you try to open a binary file with a regular text editor, it will look messy and hard to read because the editor will try to turn each group of bits into a character. Some programs can show just the readable text from a binary file, which can help find hidden words or check if a file might be doing something unexpected. If the file is a type of program and you run it, the computer will try to follow the instructions inside it.

Interpretation

Standards help us understand binary files. For example, a binary file read using the ASCII system might show text. But a special program can see the same file as sounds, pictures, or even whole words. Binary data only means something when a program decides what each part is. Just looking at the binary might not tell you what it really is.

This idea is used in steganography, where a program sees a file in a new way to find hidden messages. Without the special program, you can't even know those hidden messages are there.

Binary compatibility

For binary code executable file compatibility, see Binary compatible.

Two files that work well together will have the same pattern of zeros and ones in the main part of the file. However, the beginning part of the file, called the header, might look different.

This idea is often used to describe how data files from one program are exactly the same as files from another program. For example, some companies make programs for both Windows and the Macintosh that work well together. This means a file made on a Windows computer can be used on a Macintosh computer without any problems. This helps avoid issues that happen when moving data between different programs.

One possible problem is how computers arrange the bytes in a file. Some computers store these bytes in a different order.

Related articles

This article is a child-friendly adaptation of the Wikipedia article on Binary file, available under CC BY-SA 4.0.