Base64 Encoder & Decoder
Encode text to Base64 or decode Base64 back to text, with full UTF-8 support and a specific message when the input is not valid Base64.
Base64 is an encoding, not encryption. Anyone can decode it, so it hides nothing.
Type or paste text. It is converted to UTF-8 bytes and then to Base64. The limit is 1,000,000 bytes. Then press Encode.
Enter text, or choose Load example, then press Encode.
The text in the box changed after this was shown. Press the button to update.
This could not be converted
Result
How to Use the Base64 Encoder & Decoder
- Choose a direction: encode text to Base64, or decode Base64 to text.
- Type or paste into the box, or press Load example.
- Press Encode or Decode, or press Ctrl+Enter (Cmd+Enter on a Mac) inside the box.
- Read the result, or the message that says what is wrong and where. Press Copy result to copy it.
What Base64 Is and Is Not
Base64 writes any bytes using 64 safe characters (A-Z, a-z,
0-9, + and /), so binary or non-ASCII data can travel
through text-only places such as e-mail, headers,
configuration files and data URIs. Every three bytes become
four characters, and = pads the end when the
length is not a multiple of three.
It is not encryption. It uses no key and anyone can reverse it, so never treat Base64 as a way to protect a password or a token. The parts of a token are Base64 text: the JWT Decoder reads them for you (a JWT uses the base64url variant, which this tool does not read), and the JSON Formatter & Validator helps once the text inside is JSON.
How This Tool Reads Your Input
Encoding turns your text into UTF-8 bytes
exactly as typed (no trimming) and writes standard Base64
with = padding and no line breaks. Accented
letters, other scripts and emoji are handled as UTF-8.
Decoding is strict about what it accepts and says why when it refuses:
- Only ASCII space, tab, carriage return and line feed are ignored, anywhere. Any other character that is not in the alphabet is refused with its position.
- Missing padding is accepted. Padding that is present must be right, and
=may only appear at the end, at most twice. - A single leftover character cannot encode a byte, so that is refused as probably cut short.
- The unused bits of the last character must be zero, as an encoder writes them.
QR==is refused even though some decoders read it asA: a stray bit usually means a typo or a truncated value. - The result must be valid UTF-8 text. Other bytes are reported as binary data and are not shown as garbled characters.
- - and _ belong to base64url, a different alphabet, and are refused with that hint.
Base64 Encoder & Decoder FAQ
Is my text sent anywhere?
No. The conversion runs in your browser and nothing is uploaded, stored or logged.
Why does a decoder elsewhere accept something this one refuses?
Many decoders are lenient: they accept stray bits in the last character, skip unknown characters or guess at padding. This tool is strict so that a typo or a cut-off value is reported instead of turning into slightly wrong text.
Why does decoding say my data is not text?
The Base64 is valid, but the bytes it holds are not UTF-8 text, for example an image or a compressed file. This tool shows text only, so it tells you the byte count instead of printing unreadable characters.
Can I decode a Base64 value without the = at the end?
Yes. Missing padding is accepted and the result says it was assumed. A length that no padding can fix is refused.
Is there a size limit?
Yes: 1,000,000 bytes of UTF-8 to encode, and 1,333,336 characters (whitespace included) to decode, which is the Base64 of that many bytes.