How does Base64 encoding work?
Base64 groups the data into blocks of 3 bytes (24 bits), splits each block into four 6-bit groups, and maps each group to one of 64 characters. If the data is not a multiple of 3 bytes, "=" padding is added. Because 3 bytes become 4 characters, Base64 output is about 33% larger than the input.
Example: "Hi" is the bytes 72 and 105. In binary that is 01001000 01101001. Regrouped into 6 bits: 010010 000110 1001(00), which is the characters S, G, k and a "=" for padding: SGk=.
Where Base64 is used
- Email attachments and inline images (MIME).
- Embedding small images in web pages as data URLs.
- JSON web tokens and API credentials, in the URL-safe form.
- Storing binary data in text formats such as XML and JSON.
The URL-safe form replaces + with − and / with _ and drops the padding. The tool shows it when you encode.
Is Base64 secure?
No. Base64 only changes the representation of the data. Anyone can decode it instantly, so never use it to hide passwords or personal information. To protect data you need encryption. To encode text for web addresses, use the URL encoder, and to make strong passwords, the password generator. Your text is processed in your browser and is never sent to us.
Common mistakes with Base64
If decoding fails, check for missing characters, extra spaces and line breaks, or a URL-safe string that uses - and _ where standard Base64 expects + and /. Remember that Base64 grows the data by about a third, and that it is only a way of writing bytes as text. For anything private, use encryption, not encoding.
Complete guide to the Base64 Encode and Decode
How to use the Base64 Encode and Decode, step by step
- Choose encode or decode.
- Paste your text.
- Read the result and the URL-safe form.
- Copy it.
Common mistakes to avoid
- Treating Base64 as security.
- Adding extra spaces or line breaks.
- Forgetting the padding when decoding.
Key terms explained
- Encoding
- Changing the form of data.
- Padding
- The = characters at the end.
- UTF-8
- The standard way to store text as bytes.
- URL-safe
- A variant using − and _.
Want the full walkthrough? Read our guide: How Base64 Encoding Works (With Examples).
Frequently asked questions
What is Base64 used for?
To carry binary data inside text, for example in emails, JSON and data URLs.
Is Base64 encryption?
No. It is a reversible encoding and offers no protection.
Why does Base64 end with =?
The = characters pad the output so its length is a multiple of 4.
Does it support accents and emoji?
Yes. The text is converted to UTF-8 bytes before encoding, so accents, other alphabets and emoji all work and decode back correctly.
What is URL-safe Base64?
A variant that uses − and _ instead of + and /, so it can be placed in web addresses.