# Binary File

> A file of raw bytes, not words. Pictures, apps and songs are all binary.

**Field:** Software Development  
**Category:** Files & Formats  
**Also known as:** Binary Format, Non-Text File

## Think of it like

Think of it like a CD. A player can read it, but you cannot read it just by looking.

## Definition

A binary file stores data as raw bytes that are not meant as text. Pictures, songs, videos, apps and ZIP files are all binary. Only a program that knows the format can make sense of one. Open it in a text editor and you see strange symbols. Binary files are often smaller and faster to read than the same data as text.

## Example

Lucy opens song.mp3 in a text editor by mistake. She sees odd symbols, because the file is sound, not words.

## Example code

```console
$ head -c 8 photo.png | xxd
00000000: 8950 4e47 0d0a 1a0a                      .PNG....
```

The first eight bytes of a PNG picture. Most are not letters, so they show as dots.

## Why it matters

Tools treat text and binary files in different ways. Git cannot show which lines changed in a picture.

## Common mistake

Opening a binary file in a text app and saving it. The app can change bytes and break the file for good.

## Three principles

- **Raw bytes.** Most bytes are not letters.
- **Needs its program.** Only a program for its format can read it.
- **Compact.** Often smaller than the same data as text.

## Related terms

- [Plain Text File](https://learn.benibix.com/term/development/plain-text-file)
- [File Format](https://learn.benibix.com/term/development/file-format)
- [Machine Code](https://learn.benibix.com/term/development/machine-code)
- [ZIP File](https://learn.benibix.com/term/development/zip-file)
- [Binary Number System](https://learn.benibix.com/term/general/binary-number)
- [Executable File](https://learn.benibix.com/term/development/executable-file)

## Told apart from

- [Executable File vs Binary File](https://learn.benibix.com/compare/executable-file-vs-binary-file): A binary file is any file that is not plain text, like a photo or a zip. An executable is one kind. It is a program you can start.

## Taught in

- [Plain Text and Binary Files](https://learn.benibix.com/learn/development-formats/plain-text-and-binary-files): File Formats, 2/11

![Two panels. On the left, notes.txt, with .txt picked out, holds two readable lines, Buy milk and Call Jack at 5, and carries the label text/plain. On the right, photo.png, with .png picked out, holds rows of hex bytes starting 89 50 4E 47, and carries the label image/png. Notes under them say the ending after the dot is the file extension and the label is the media type a server sends.](https://learn.benibix.com/diagrams/dev2-file-types.svg)

---

Source: https://learn.benibix.com/term/development/binary-file
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-18
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
