← All guides

What Is Base64 Encoding (and How to Decode It)

Base64 encodes binary data as 64 safe text characters so it survives text-only channels. Learn how it works, when to use it, and why it is not encryption.

Base64 encoding represents binary data using 64 safe ASCII characters — A–Z, a–z, 0–9, plus + and / — so the data can travel through text-only systems like email or JSON without being corrupted. Decoding simply reverses the process to recover the original bytes.

How it works

Base64 takes three bytes (24 bits) at a time and splits them into four 6-bit groups, each mapped to one character. When the input length is not a multiple of three, one or two = characters pad the end.

The size trade-off

Because every 3 bytes become 4 characters, Base64 output is about 33% larger than the original. That is the cost of making binary safe to embed as text.

Common uses

  • Data URIs — embedding images directly in CSS or HTML
  • Email attachments — MIME encodes files as Base64
  • JWT — the header and payload are Base64url-encoded
  • HTTP Basic auth — credentials are Base64-encoded (not encrypted)

It is not encryption

This is the key point: Base64 is encoding, not security. Anyone can decode it instantly, so never use it to hide passwords or secrets. It only makes data transport-safe, not private.

Encode or decode now

Paste text into the Base64 encoder/decoder to convert both ways in your browser — nothing is uploaded. Working with images? Try image to Base64. Related: What is a JWT and how to decode it.