Base64 Encoder/Decoder

Encode plain text to Base64 or decode Base64 strings back to readable text. Handles Unicode characters, runs entirely in your browser, and never sends data to a server.

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts binary data into a sequence of printable ASCII characters. It uses a 64-character alphabet consisting of uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), and two additional symbols (+ and /). A padding character (=) is appended when the input length is not a multiple of three bytes.

The encoding process works by taking every three bytes (24 bits) of binary data and splitting them into four groups of six bits each. Each six-bit group maps to one of the 64 characters in the Base64 alphabet. Because three input bytes become four output characters, Base64-encoded data is roughly 33% larger than the original.

Why Use Base64?

Base64 encoding exists to solve a fundamental problem: many communication protocols and storage systems are designed to handle text, not raw binary data. When you need to transmit images, files, or other binary content through text-only channels, Base64 provides a safe and reliable way to represent that data.

Common scenarios where Base64 encoding is essential include:

How the Encoding Process Works

Base64 encoding follows a straightforward algorithm. First, the input text is converted to its binary representation using a character encoding such as UTF-8. The resulting byte stream is then divided into groups of three bytes. Each three-byte group (24 bits) is split into four six-bit values. Each six-bit value is used as an index into the Base64 character table to produce four ASCII characters.

If the final group contains fewer than three bytes, padding is applied. One remaining byte produces two Base64 characters followed by two = signs. Two remaining bytes produce three Base64 characters followed by one = sign. This padding ensures the encoded output length is always a multiple of four.

Example

The word "Hi" in ASCII is represented as the bytes 72 and 105. In binary, that is 01001000 01101001. Splitting into six-bit groups gives 010010 000110 100100 (with two zero-padding bits). These map to the Base64 characters S, G, k, producing the encoded string SGk= (with one padding character because the input was only two bytes).

Base64 and Unicode

Standard Base64 encoding operates on bytes, not characters. When your input contains Unicode characters -- such as accented letters, emoji, or CJK ideographs -- the text must first be encoded to a byte sequence using UTF-8 before Base64 encoding is applied. This tool handles that conversion automatically, so you can safely encode and decode strings in any language.

Security Considerations

It is important to understand that Base64 is an encoding scheme, not an encryption method. Base64 provides no confidentiality whatsoever: anyone can decode a Base64 string instantly using any decoder. Never use Base64 as a way to protect sensitive information such as passwords, API keys, or personal data. If you need to protect data in transit, use proper encryption protocols like TLS. If you need to protect data at rest, use authenticated encryption algorithms like AES-GCM.

Variants of Base64

Several Base64 variants exist for different use cases. The standard encoding (RFC 4648) uses + and / as the 62nd and 63rd characters. The URL-safe variant replaces these with - and _ to avoid conflicts with URL-reserved characters. Some implementations omit the padding = characters entirely, since the original length can be inferred from the encoded length. This tool uses the standard Base64 alphabet as defined in RFC 4648.

About This Tool

This Base64 encoder/decoder runs entirely in your browser using JavaScript. No data is transmitted to any server -- your text stays on your device. It supports full Unicode input, automatically detects Base64-encoded content when you paste, and provides instant encoding and decoding with clear error messages for malformed input.