Base64 Encoding: What It Is and When to Use It

📅 2026-05-02🏷️ Data Tools⏱️ 5 min read

What is Base64?

Base64 is a binary-to-text encoding that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /).

Why Was It Invented?

Early protocols like SMTP were 7-bit ASCII only. Binary files would get corrupted in transit. Base64 solves this by encoding any binary data as safe ASCII text.

How It Works

Every 3 input bytes (24 bits) become 4 output characters (6 bits each). Output is ~33% larger than input.

Common Uses

  • Data URIsdata:image/png;base64,...
  • HTTP Basic AuthAuthorization: Basic dXNlcjpwYXNz
  • JWT — header and payload are Base64url-encoded
  • MIME attachments in email

Base64 vs Base64url

Standard Base64 uses + and /. Base64url replaces them with - and _ so the output is URL-safe.

Try our free Base64 tool for instant encoding and decoding.

Found this useful? Try our Base64 Encoder/Decoder — browser-based and free forever.