flashman
← All guides

Base64 encoding explained (and why it is not encryption)

What Base64 is for, when to use it, and common pitfalls with Unicode and padding.

2026-05-28 · 4 min read

Base64 represents binary data as ASCII text using 64 safe characters. It is used in email (MIME), data URLs, and HTTP Basic authentication. It provides encoding, not confidentiality—anyone can decode it instantly.

When Base64 helps

Choose Base64 when the channel is text-only. Do not choose it to protect secrets.

  • Embedding small images in CSS or HTML (data URLs)
  • Transporting binary blobs in JSON or XML
  • Representing credentials in Authorization headers (still use HTTPS)

Unicode and padding

Text must be encoded to bytes (UTF-8) before Base64. Padding characters (=) may appear at the end. URL-safe variants swap +/ for -_ to avoid breaking URLs.

Try these tools