Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 strings back to plain text. This tool processes everything locally in your browser, ensuring your data remains private and secure.

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using a set of 64 printable ASCII characters. It was designed to carry data stored in binary formats across channels that only reliably support text content. The name "Base64" comes from the fact that it uses 64 different characters to represent data.

How Base64 Works

Base64 encoding works by taking groups of three bytes (24 bits) of binary data and splitting them into four groups of six bits each. Each six-bit group is then mapped to one of 64 characters: A-Z (26), a-z (26), 0-9 (10), and two additional characters (typically + and /). If the input data length is not a multiple of three, padding characters (=) are added to the output.

This means Base64-encoded data is approximately 33% larger than the original binary data, which is the trade-off for being able to safely transmit binary data as text.

Common Uses of Base64

  • Email attachments: MIME encoding uses Base64 to embed binary files (images, documents) in email messages, which are fundamentally text-based
  • Data URIs: Embedding small images directly in HTML or CSS using data:image/png;base64,... eliminates additional HTTP requests
  • API authentication: HTTP Basic Authentication encodes username:password pairs in Base64 before sending them in request headers
  • JSON Web Tokens (JWT): JWTs use Base64URL encoding for their header and payload sections
  • Storing binary data in text formats: When binary data needs to be stored in XML, JSON, or database text fields

Important Security Note

Base64 is an encoding scheme, not an encryption method. It provides no security whatsoever — anyone can decode a Base64 string instantly. Never use Base64 to "hide" sensitive information like passwords, API keys, or personal data. For actual security, use proper encryption algorithms like AES or RSA.

Base64 vs Base64URL

Standard Base64 uses + and / characters, which can cause issues in URLs and filenames. Base64URL is a variant that replaces + with - and / with _, making it safe for use in URLs, cookies, and filenames without requiring additional encoding. This variant is commonly used in JWTs and web applications.