Base64 Encode & Decode
Convert text, files and images to and from Base64 and Base64URL. Detects file types, previews images and pinpoints invalid characters.
How Base64 Works
Base64 takes the input 3 bytes (24 bits) at a time and splits them into four 6-bit groups. Each 6-bit value (0–63) is mapped to one character of the Base64 alphabet. When the input length is not a multiple of 3, the output is completed with one or two "=" padding characters.
| Text | M | a | n | |||||||||||||||||||||
| Bits | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | 0 |
| Base64 | T | W | F | u | ||||||||||||||||||||
Because 3 bytes become 4 characters, Base64 output is about 33% larger than the original. That trade-off is what makes it possible to carry binary data through systems designed for text.
Images in HTML and CSS
Embed tiny icons and placeholders as data URIs to avoid an extra request.
Email attachments
MIME encodes attachments in Base64 with lines of 76 characters.
Tokens and credentials
JWTs use Base64URL; HTTP Basic auth sends user:password in Base64 (which is why it needs HTTPS).
APIs and JSON
Send files or binary blobs inside JSON payloads that only support text.
Configuration and secrets
Kubernetes secrets and many config files store values Base64-encoded — remember it is not encryption.
Debugging
Decode suspicious strings from logs, cookies or URLs to see what they really contain.
Frequently Asked Questions
Was this tool helpful?
Thanks for your feedback!
Could not send your feedback. Please try again.