Base64 Encoder/Decoder
By Stuart Mathieson · Updated October 2026
About Base64:
Base64 encoding converts binary data into ASCII text. It's used in emails, URLs, and data URIs. This tool supports UTF-8 for international characters.
How Base64 encoding works
Base64 turns any data into text using 64 characters: A-Z, a-z, 0-9, + and /. It takes the data 3 bytes (24 bits) at a time and splits them into four 6-bit groups. Each group is a number from 0 to 63, which becomes one character. When the data doesn't divide evenly into 3 bytes, = signs pad the end.
Text is first converted to UTF-8 bytes, so accented letters and emoji take more than one byte:
| Text | Bytes | Base64 |
|---|---|---|
| Hi | 2 | SGk= |
| Hi! | 3 | SGkh |
| Hello | 5 | SGVsbG8= |
| é | 2 | w6k= |
Every 3 bytes become 4 characters, so Base64 output is about a third larger than the original - 300 bytes become 400 characters.
Things to know
- It is not encryption. Anyone can decode Base64, so never use it to hide passwords or other secrets.
- URL-safe Base64. A common variant replaces + and / with - and _ so the result can go in web addresses, and often leaves off the = padding. This tool uses the standard alphabet, so to decode a URL-safe string, change - to + and _ to / first.
- Spaces and line breaks in Base64 input are ignored when decoding, so wrapped text decodes fine.
- Text only. This tool decodes to text. If the decoded data isn't valid UTF-8 text - an image, for example - you will see replacement characters (�).
Frequently asked questions
Is Base64 the same as encryption?
No. Base64 is encoding, not encryption - it's fully reversible by anyone and provides no security or confidentiality. Never use it to "protect" sensitive data.
What is Base64 typically used for?
Embedding small images or files as data URIs in HTML/CSS, encoding binary data in JSON or XML, and safely transmitting data through systems designed for plain text.
Why did decoding fail?
The input isn't valid Base64 - it likely contains characters outside the Base64 alphabet or has incorrect padding. Double-check you copied the full encoded string.
Why does Base64 output end with = signs?
Base64 works on groups of 3 bytes. When the data doesn't divide evenly into 3, one or two = signs are added so the output length is always a multiple of 4.
Sources
- RFC 4648: The Base16, Base32, and Base64 Data Encodings - Internet Engineering Task Force
- Base64 - MDN Web Docs