Base64 Encoder / Decoder

Paste text to encode it to Base64, or paste Base64 to decode it. Handles Unicode & UTF-8.

Decoded (Plain Text)

Encoded (Base64)

A Developer's Guide to Base64 Encoding and Decoding

Welcome to the most robust and secure Base64 Encoder and Decoder on the web. This tool is a fundamental utility for any developer, data scientist, or security professional. It provides an instant, reliable way to encode text to Base64 or decode Base64 to text. Unlike most online tools, ours correctly handles all Unicode and UTF-8 characters (including emojis), not just ASCII.

Our core promise is security. This Base64 converter is 100% client-side. All processing happens in your browser. Whether you're working with API keys, file data, or private strings, your information is never sent to our servers, giving you complete peace of mind.

Advanced Features

Unicode (UTF-8) Support

Correctly encodes and decodes emojis, accents, and all UTF-8 characters.

100% Client-Side

Your data never leaves your browser. Safe for sensitive information.

Instant & Free

Get immediate, accurate results with no ads or rate limits.

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme. Its primary purpose is to convert binary data (like the raw bytes of an image, file, or even complex text) into a simple, text-only format that can be safely transmitted over systems designed to handle just text.

The name "Base64" comes from the fact that it uses a 64-character alphabet to represent the binary data. This alphabet consists of:

By representing all data using only these "safe" characters, Base64 ensures that the data isn't corrupted or misinterpreted when sent through text-based protocols like email (MIME) or when embedded in text-based formats like HTML, CSS, JSON, or XML.

How Does Base64 Work? (A Technical Look)

The Base64 algorithm is a clever process of bit-shifting. It takes 3 bytes (which are 8 bits each, for a total of 24 bits) and "re-chunks" them into 4 groups of 6 bits. Each 6-bit group can represent a number from 0 to 63, which maps directly to one of the 64 characters in the alphabet.

  1. Input: Take 3 bytes of binary data (e.g., `01001101 01100001 01101110` which is the text "Man").
  2. Group Bits: Combine them into a single 24-bit stream: `010011010110000101101110`.
  3. Re-chunk: Split this stream into 4 chunks of 6 bits each: `010011`, `010110`, `000101`, `101110`.
  4. Map to Base64: Convert these 6-bit binary numbers to their decimal (0-63) and Base64 character equivalents:
    • `010011` = 19 = `T`
    • `010110` = 22 = `W`
    • `000101` = 5 = `F`
    • `101110` = 46 = `u`
  5. Output: The 3-byte string "Man" becomes the 4-character Base64 string "TWFu".

What is Base64 Padding (`=` and `==`)?

Since the algorithm works on 3-byte input chunks, what happens if your data isn't a perfect multiple of 3? This is where padding comes in. If the input has only 1 byte, it's padded to 3 bytes, and the output gets two `==` characters. If the input has 2 bytes, it's padded to 3, and the output gets one `=` character. This padding ensures the final Base64 string length is always a multiple of 4.

Base64 vs. Encryption vs. Hashing: A Critical Distinction

This is the most common misconception. These three concepts are fundamentally different and are *not* interchangeable.

Common Uses for Base64 in Modern Development

Handling Unicode & UTF-8 (The `btoa` Problem)

A major flaw in many online Base64 encoders is that they use the native JavaScript function btoa() directly. This function was created when the web was ASCII-only and will throw an error if you try to encode a string with Unicode characters (like `€` or `😊`).

Our tool is different. We solve this by first using the modern `TextEncoder` API to convert your Unicode string into a stream of **UTF-8** bytes. Then, we convert those bytes into a binary string that `btoa()` can safely encode. Our decode function reverses this process using `TextDecoder`. This makes our tool robust and capable of handling any text you throw at it, from any language.

Frequently Asked Questions

What is Base64 encoding?

Base64 is an encoding scheme that converts binary data (like images, or files) into a text-only (ASCII) format. It uses a 64-character alphabet to represent the binary data, making it safe to transmit over systems that are designed to handle only text.

Is Base64 encoding a form of encryption?

No, this is a common misconception. Base64 is an *encoding* scheme, not an *encryption* one. It is not secure and is easily reversible (as this tool proves!). It should never be used to protect sensitive data. Its purpose is to ensure data integrity during transmission, not to hide it.

Why does this tool work with Emojis (Unicode) while others fail?

Most simple Base64 tools use the built-in browser function `btoa()`, which only supports ASCII characters and fails on Unicode. Our tool first uses a `TextEncoder` to convert the Unicode text into a UTF-8 byte stream, and *then* Base64-encodes those bytes. This is the correct, modern way to handle all text.

Why is Base64 used so often on the web?

Its most popular use is in 'Data URLs' to embed images or other files directly into HTML, CSS, or JSON. For example, `data:image/png;base64,...` allows you to include an image in a webpage without needing a separate file. It's also used in email (MIME) and for parts of JSON Web Tokens (JWTs).

What is Base64 padding (the `=` sign)?

Base64 works by converting 3 bytes of data (24 bits) into 4 Base64 characters (6 bits each). If the input data is not a multiple of 3 bytes, the output is 'padded' with one or two `=` characters at the end to make the output length a multiple of 4. This padding is sometimes optional but is part of the standard.

What is the difference between Base64 and Base64Url?

Base64Url is a variant of Base64. The standard Base64 alphabet includes `+` and `/`, which are special characters in URLs. Base64Url replaces `+` with `-` (minus) and `/` with `_` (underscore) and typically omits padding. It's used in JWTs and other URL-safe applications.