How to encode or decode Base64
- 1Type or paste into Input, or drop a file onto it. Plain text is encoded; a valid Base64 string is decoded.
- 2If Auto picks the wrong direction, choose Encode or Decode. Turn on URL-safe, No padding or Wrap 76 to match the format you need.
- 3Copy the result, download it as a file, or press Swap to run it back the other way.
What is Base64?
Base64 is a way to write binary data using only 64 printable characters. Every 3 bytes of input become 4 characters of output, so the encoded text is about 33% larger than the original. It is used wherever a system only accepts text: email attachments, data URIs in HTML and CSS, JSON payloads, HTTP Basic auth and JSON Web Tokens.
Each character stands for a 6-bit value from 0 to 63. When the input length isn’t a multiple of 3, one or two “=” characters pad the end.
Standard, URL-safe and MIME Base64
The decoder accepts all three variants automatically. When encoding, use the toggles above the input to choose one.
Frequently asked questions
Is Base64 encryption?
No. Base64 is an encoding, and anyone can reverse it without a key. Use it to carry binary data through text-only channels, not to protect it. For secrecy, encrypt first and then Base64-encode the ciphertext.
Why does decoding fail?
The usual causes are a character outside the Base64 alphabet, padding “=” in the middle of the string, or a string that was cut off. The decoder highlights the exact position. Spaces and line breaks are ignored, and URL-safe input is accepted.
Why is the decoded result unreadable?
The Base64 probably holds binary data such as an image, a ZIP file or compressed bytes, not text. The tool shows a hex preview in that case. Download the result to get the original file, or use Base64 to image for pictures.
Which character encoding is used for text?
UTF-8 by default. Chinese, Japanese, emoji and other non-Latin characters round-trip correctly. For legacy Simplified Chinese data, choose GB2312 in the encoding menu. Strings encoded from UTF-16 or other code pages may decode to unexpected characters.
Are my text and files uploaded?
No. Encoding and decoding run in your browser with JavaScript. Nothing you type or drop is sent to a server.