Base64 Encoder/Decoder
Encode text to Base64 or decode Base64 strings instantly, with full UTF-8 and URL-safe support.
What is Base64?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It's used whenever binary data needs to pass through systems designed for text — email, JSON payloads, HTML attributes, and URLs.
The encoding increases size by roughly 33% (every 3 bytes of input becomes 4 characters of output), which is why it should only be used for transport, not storage.
Common use cases
- Email attachments (MIME)
- SMTP only supports 7-bit ASCII. Base64 encoding lets binary attachments (images, PDFs) travel safely through email servers.
- Data URIs
-
Embed small images directly in HTML or CSS using
data:image/png;base64,...to avoid extra HTTP requests. - API authentication
-
HTTP Basic Authentication encodes
username:passwordas Base64 in theAuthorizationheader. Note: this is encoding, not encryption — it provides no security on its own. - JWT tokens
- JSON Web Tokens use URL-safe Base64 to encode the header and payload sections.
- Configuration files
- Kubernetes Secrets, SSH keys in CI/CD, and certificate PEM files all use Base64 encoding.
URL-safe Base64
Standard Base64 uses + and /, which have special meaning in
URLs and filenames. The URL-safe variant (RFC 4648 §5) replaces them:
+becomes-/becomes_- Trailing
=padding is stripped
Use URL-safe encoding for JWT tokens, URL parameters, and filename-safe identifiers.
UTF-8 handling
The browser's native btoa() function only handles Latin-1 characters and
throws on anything outside that range (like emoji or CJK characters). This tool uses
a UTF-8 encoding step first, so characters like 日本語 and 🚀
encode and decode correctly.