What is Base64?
Base64 turns any data, including text and binary files, into plain letters, digits, + and /. It's used where only text is allowed: email attachments, data URLs in HTML and CSS (data:image/png;base64,…), JSON payloads, HTTP Basic authentication headers and JSON Web Tokens.
Base64 is not encryption
Anyone can decode Base64 in a second, so never use it to hide passwords or secrets. It's an encoding, not a lock.
Why is the result bigger?
Every 3 bytes become 4 characters, so encoded data is about 33% larger. A 30 KB image becomes about 40 KB of text. That's why data URLs are best for small icons, not large photos.
URL-safe Base64
Standard Base64 uses + and /, which have special meanings in web addresses. URL-safe Base64 replaces them with - and _ and often drops the = padding. JWTs and many APIs use this form.
Unicode text works
Text is converted to UTF-8 before encoding, so Urdu, Arabic, Hindi and emoji encode and decode correctly. If decoding shows strange characters, the data may be a file rather than text, or it was encoded with a different character set.
For web addresses, use the URL Encoder instead.