Base64: binary data as plain text
Some places only accept plain text: email, JSON, HTML attributes. Base64 turns any data into 64 safe characters (A–Z, a–z, 0–9, + and /), so it can travel through them unchanged. "Hello" becomes SGVsbG8=.
- Every 3 bytes become 4 characters, so Base64 is about 33% bigger than the original.
- The = signs at the end pad the output to a multiple of 4 characters.
- The URL-safe variant uses - and _ instead of + and /, which have special meanings in web addresses.
It is not encryption
Anyone can decode Base64; there is no key. Never use it to hide a password or other secret.
Data URIs
A small image can be written straight into HTML or CSS as data:image/png;base64, followed by its Base64 text, saving a separate download. Because of the size increase, this only makes sense for small icons. The Image to Base64 tool makes the data URI for you, or turns one back into an image.
URL encoding is something else
URL (percent) encoding only replaces characters that are not allowed or have a special meaning in a web address, each with % and its byte value. "café & crème" becomes caf%C3%A9%20%26%20cr%C3%A8me: the space is %20, & is %26, and é, two bytes in UTF-8, is %C3%A9. Everything else stays readable.
Encode and decode text with Base64 Encode / Decode and URL Encode / Decode.