Skip to content

Base64 Encode/Decode

Encode or decode Base64 strings instantly.

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data as a string of printable ASCII characters. It works by taking groups of three bytes (24 bits) and splitting them into four 6-bit values, each mapped to a character from a 64-character alphabet: A-Z, a-z, 0-9, plus sign (+), and forward slash (/). Padding with equals signs (=) is added when the input length is not a multiple of three.

Encoding Is Not Encryption

A common misconception is that Base64 provides security. It does not. Base64 is a reversible encoding — anyone can decode a Base64 string back to its original form without a key or password. It is designed for data transport, not data protection. If you need to secure data, use proper encryption algorithms like AES-256 and manage keys appropriately.

Common Use Cases

  • Email attachments — MIME encoding uses Base64 to embed binary files (images, documents) inside text-based email messages.
  • Data URIs — Embedding small images or fonts directly in HTML or CSS using data: URLs.
  • API payloads — Transmitting binary data within JSON, XML, or URL query strings that only support text characters.
  • Authentication headers — HTTP Basic Authentication encodes the username and password pair as Base64 (though this is not secure without HTTPS).
  • Certificates and keys — PEM-formatted SSL certificates and cryptographic keys are Base64-encoded for safe storage in text files.

UTF-8 Support

This tool handles multi-byte characters (like accented letters, CJK characters, and emoji) correctly by using the TextEncoder and TextDecoder APIs. Standard btoa() in JavaScript only supports Latin-1 characters, but our implementation converts UTF-8 text to bytes first, ensuring accurate encoding and decoding for any language or character set.