base64

base64 is a way of writing any file using only ordinary letters, digits and two punctuation marks, so that it can travel inside text.

In more detail

A file is a sequence of bytes, and a byte can hold values no text format is willing to carry. The trick is to take the bytes three at a time and write them as four harmless characters, so nothing in the original can upset whatever is reading it.

Four characters where there were three bytes makes the whole thing about a third bigger. Nothing else changes: turning it back gives the very same bytes, to the last one.

What it does on a real document

A font sent inside a description travels this way, because the description is text and a font is not. A file sent as its own part of the call needs none of it, which is why a large picture is better sent as a part than written into the description.

The same encoding turns up inside PDF files themselves, where a stream may be written in it rather than in raw bytes.

Where it comes from, and why

It comes from electronic mail, which for years could carry nothing but plain letters. Attaching a photograph meant writing it as letters, and that is still how a mail attachment travels.

The name counts the alphabet it uses: sixty-four characters chosen because every system in use agreed on them.

Back to the whole glossary