Base64 rewrites arbitrary bytes using only 64 printable characters, which is why it turns up in data URIs, email attachments, JSON payloads and basic authentication headers. This tool encodes text to Base64 and decodes it back, and it handles the whole of Unicode correctly. Text is converted to UTF-8 bytes first, so accented letters, Greek, Chinese and emoji all survive the round trip instead of throwing the character range error that plain btoa produces.
Three options cover the common variants. The URL-safe alphabet swaps plus and slash for hyphen and underscore and drops the trailing equals signs, which is what JSON Web Tokens and query parameters use. Line wrapping at 76 characters matches the MIME convention used in email. Stripping whitespace before decoding lets you paste a wrapped or indented string straight in. Invalid input is reported with the specific reason rather than a generic failure.
How to use the Base64 Encoder Decoder
- Choose Encode text to Base64 or Decode Base64 to text from the mode list.
- Paste your text or your Base64 string into the input box.
- Tick URL-safe if the value is going into a URL or a token, and line wrapping if it is going into an email header or a PEM style block.
- Click Convert, read the byte counts, then click Copy. Use output as input to run the reverse conversion and check the round trip.
Frequently asked questions
Is Base64 a form of encryption?
No. It is a reversible encoding with no key and no secret, and anyone can decode it in a second. Use it to move binary data safely through text only channels. If the content needs to stay private, encrypt it first and then Base64 the ciphertext.
Why does Base64 make my data bigger?
Every 3 bytes of input become 4 output characters, which is a growth of roughly 33 percent, plus up to 2 padding characters at the end. Line breaks add a little more. That overhead is the reason inline data URIs for large images are usually a poor trade.
What is URL-safe Base64?
Standard Base64 uses plus and slash, both of which have a meaning inside a URL and would need percent encoding. The URL-safe variant defined in RFC 4648 replaces them with hyphen and underscore and normally omits the equals padding. JSON Web Tokens use this variant.
Why does my Base64 fail to decode?
The usual causes are a stray character outside the alphabet, a length that is not valid for Base64, padding in the middle after two strings were joined, or a URL-safe string decoded as standard. Tick Strip whitespace if your string is wrapped across several lines.