# Plain Text and Binary Files

> How a plain text file differs from a binary one. Why a ZIP file shrinks text but not photos, and why a PDF looks the same on every screen.

**Course:** [JSON, YAML and File Formats](https://learn.benibix.com/learn/development-formats)  
**Time:** 11 min

**After this lesson you can:**

- Tell a text file from a binary file
- Say what a ZIP file does to text and to photos
- Explain what a PDF keeps fixed

## What makes a file text, and what makes it binary

A plain text file holds only characters you can read: letters, digits and signs. Code, JSON, CSV and Markdown files are all plain text. A binary file holds raw bytes that are not meant as text, like a photo, a song or an app. A page of text is a few kilobytes, while one phone photo is a few megabytes.

Plain text has big upsides. Any text editor can open it, on any computer, years from now. Tools like Git can show which lines changed. You can read it and fix it by hand.

Binary files win on size and speed. Open one in a text editor and you see a mess of odd signs. A photo stored as text would be huge and slow to load. Only a program that knows the format can read one, so you open it with the right app, not a text editor.

A ZIP file packs many files and folders into one binary file. It usually squeezes them too, which is called compression. Nothing is lost: unzipping gives back the exact same bytes. Text often shrinks to a tenth of its size or less.

Photos, music and videos barely shrink in a ZIP. Formats like JPG are already squeezed, so there is little left to take out. Zip a folder of photos to send it as one file, not to save space.

A PDF is a binary format that keeps a page looking the same everywhere. It stores the exact place of every word and picture, and it carries its own fonts. Adobe made it in 1993, and it became an open ISO standard in 2008.

The price of a fixed page is that it does not flow. On a phone, a PDF page just shrinks, while a web page moves its parts to fit. Editing a PDF is hard for the same reason. Use it for things you print, sign or send to keep.

```console
$ zip notes.zip notes.txt
  adding: notes.txt (deflated 94%)
```
ZIP squeezes a text file by 94 percent here. A photo would barely shrink at all.

![Three files on the left, notes.txt, plan.txt and photo.jpg, go through an arrow marked zip into one box called files.zip, then through an arrow marked unzip back into the same three files. Under it, two bars: notes.txt alone at 4,011 bytes, and the same file zipped at 394 bytes, a much shorter bar.](https://learn.benibix.com/diagrams/dev2-zip-file.svg)

### Example: Jack sends a folder of photos

Jack zips 40 holiday photos, 120 megabytes in all, hoping to make them small. The ZIP file comes out at 118 megabytes.

The photos were already squeezed as JPG files. The ZIP still helps, because now he sends 1 file, not 40.

**Words in this lesson:** [Plain Text File](https://learn.benibix.com/term/development/plain-text-file), [Binary File](https://learn.benibix.com/term/development/binary-file), [ZIP File](https://learn.benibix.com/term/development/zip-file), [Portable Document Format (PDF)](https://learn.benibix.com/term/development/pdf)

**Question:** Why does a ZIP of photos come out about the same size?

**Answer:** The photos are squeezed, so there is not much left to take out. JPG photos are already squeezed when they are saved. ZIP can only take out what is left, and that is very little.

---

Source: https://learn.benibix.com/learn/development-formats/plain-text-and-binary-files
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-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
