A page whose letters cost one byte each

A bank that prints two million statements a night pays for every byte twice over: once on the disc the run is kept on, once on the line it travels down. A letter is normally written into a file as a pair of bytes, because that is what it takes to reach any letter of any alphabet on earth. A statement in French needs a hundred or so of them, and the second byte is a nought on every single letter of the run.

Told to, the engine settles a number of its own for each letter a document uses, writes the list of them into the file so a reader knows what it is looking at, and then spends one byte a letter instead of two. The page shows the three lines drawn both ways and prints what each way came to, counted as the page was drawn. It ends on what the short way buys besides room: the space between words becomes something a document can widen, which is how justified text is set, and which the long way has no way of reaching.

What this example shows

  • One byte a letter instead of two, on every line of the run.
  • The file carries its own list of what each number stands for.
  • The space between words becomes something a line can widen.

The code that writes it, in full

Whole programs, hundreds of lines long, for whoever writes your software. The third is not a program at all: it is a plain list of what the page has to say, which the service is sent.

Read the Rust source Read the Python source Read the JSON source

The document itself

Open the document in English Open the document in French

First page of A page whose letters cost one byte each

What this document weighs

This document weighs 52.9 kB.

This figure is read off the very file the button above hands you, not from a table written down beside it. See what every document weighs.

The speed and weight figures on this site are measured with a licence key. See what a trial copy draws.

Details for technical readers

Exactly 52 879 bytes.

A kilobyte on this site is a thousand bytes.

Examples near this one

A minimal PDF

Two identical pages carrying the bones of an invoice in plain shapes, and not a word of lettering: the smallest file there is, and it opens anywhere.

Making the file smaller

The same document written twice, plainly and packed, with what each one weighs and what the packing saved.

Fonts kept inside the file

Text set in a typeface the file carries inside it, cut down to the letters actually used, and still searchable, copyable and readable aloud.

Every example, by subject

Glossary

byte
The unit a file's weight is counted in, the way a parcel is counted in grams. A thousand of them make a kilobyte, and a million make a megabyte — the size of one photograph taken with a telephone. A one-page PDF here weighs between six thousand and a hundred and twenty thousand, so a hundred of them fit in the space of five photographs.
justified text
Text whose lines all stop on the same right edge, as in a newspaper column. Nothing is added to the words: the spaces between them are stretched, line by line, until the line reaches the edge. It reads well in a wide column and goes loose in a narrow one, where the stretched spaces open channels of white down the page.

Every word the site explains