Base64 Encoder and Decoder

🔐 Base64 Encoder / Decoder
Output:
What Base64 is
Base64 is a way to write any data, including images and files, using only 64 safe characters: A–Z, a–z, 0–9, + and /. Systems that only handle plain text, such as email or JSON, can then carry that data without breaking it.
How it works
Base64 takes 3 bytes (24 bits) at a time and splits them into 4 groups of 6 bits. Each 6-bit group maps to one of the 64 characters. If the input doesn't divide evenly into 3 bytes, the output ends with one or two = signs as padding.
Because 3 bytes become 4 characters, Base64 text is about 33% larger than the original.
Worked example
The text Hi is 2 bytes. Encoded, it becomes SGk=. The = pads it to 4 characters.
Common uses
- Embedding small images in HTML or CSS (data URLs)
- Email attachments
- Sending binary data inside JSON or XML
- The parts of a JWT (using a URL-safe variant)
Base64 is not encryption. Anyone can decode it in a second, so never use it to hide passwords or secrets.
Frequently asked questions
Does this tool handle emoji and non-English text?
Yes. It converts text to UTF-8 bytes before encoding, so characters such as ₹, é or emoji encode and decode correctly.
Why do I get an 'invalid input' message when decoding?
The text contains characters outside the Base64 set, or its length isn't a multiple of 4. Check for missing padding or stray spaces.
One Response