# Base64

> Any data written with only letters and digits. Then it can go where only text goes.

**Field:** Software Development  
**Category:** Files & Formats  
**Also known as:** Base 64, Base64 Encoding

## Think of it like

Think of it like packing odd toys in boxes of one size. Nothing is hidden, just packed.

## Definition

Base64 writes any data, even a picture, with just 64 safe characters. Those are A to Z, a to z, 0 to 9, plus and slash. It is used where only plain text can travel, like inside emails, JSON or web addresses. The result is about a third bigger than the original. It is not a secret code: anyone can turn it back in one step.

## Example

Jack puts a small logo straight into his web page as Base64 text. The browser turns it back into the picture.

## Example code

```console
$ echo -n "Hi Emma" | base64
SGkgRW1tYQ==
```

Six letters in, eight safe characters out.

## Why it matters

It lets pictures and files ride inside text-only formats. You see it in emails, tokens and data URLs.

## Common mistake

Thinking Base64 hides data. It is not encryption, and anyone can read it back.

## Three principles

- **64 safe signs.** Letters, digits, plus and slash.
- **About a third bigger.** Four characters for every three bytes.
- **Not a secret.** Anyone can turn it back.

## Related terms

- [Character Encoding](https://learn.benibix.com/term/development/character-encoding)
- [Byte](https://learn.benibix.com/term/development/byte)
- [8-bit Unicode Transformation Format (UTF-8)](https://learn.benibix.com/term/development/utf-8)
- [JavaScript Object Notation (JSON)](https://learn.benibix.com/term/development/json)
- [URL Encoding (Percent-Encoding)](https://learn.benibix.com/term/development/url-encoding)

## Told apart from

- [Base64 vs Encryption](https://learn.benibix.com/compare/base64-vs-encryption): People think Base64 hides data, and it does not. Base64 only writes bytes with 64 safe letters and signs, so they can travel as text. It has no key, and anyone can turn it back in one step. Encryption locks data with a key. Without the key, the bytes cannot be read. Use Base64 to carry data, and encryption to keep it secret.

## Taught in

- [Escapes, Base64, URL Encoding](https://learn.benibix.com/learn/development-formats/escapes-base64-url-encoding): File Formats, 9/11

---

Source: https://learn.benibix.com/term/development/base64
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.
