Base64 Encoder & Decoder
Convert text to Base64 and Base64 back to text instantly, with full Unicode support — accented characters, non-Latin scripts, and emoji all survive the round trip. This free Base64 encoder and decoder works live as you type, entirely in your browser, so nothing you paste is ever uploaded or stored.
Encode & Decode Base64
How to Use the Base64 Encoder & Decoder
Both directions work live — type in either box and the other updates instantly:
- To encode: type or paste text into the Plain text box. The Base64 appears in the right-hand box as you type — no button needed. The Encode ↓ button forces the conversion if you ever want it.
- To decode: paste a Base64 string into the Base64 box. The original text appears on the left, live. The ↑ Decode button does the same on demand.
- Watch the stats. Below the buttons, the tool shows both lengths and the size overhead — a quick reminder that Base64 costs about 33% extra.
- Copy the result with the Copy Base64 button, or Clear both boxes to start over.
If you paste something that is not valid Base64 — a truncated string, URL-safe Base64 with - and _, or text with stray characters — you get a plain-English explanation of what looks wrong instead of a silent failure. Whitespace and line breaks are ignored automatically, so multi-line strings copied from emails decode fine.
How Base64 Encoding Works
Many systems — email, URLs, JSON, HTTP headers — were designed for plain text and mangle raw binary. Base64 is the bridge: it repackages any bytes into 64 "safe" characters (A–Z, a–z, 0–9, +, /) that survive every text-only channel.
The encoder walks through the input three bytes at a time, splits the 24 bits into four 6-bit groups, and maps each group to one character of the alphabet. When the input is not a multiple of three bytes, the last group is padded with = signs — one = if one byte is missing, two if two are. That padding is why the output length is always a multiple of four, and why you can predict the size in advance:
The crucial detail this tool gets right is Unicode. Characters like é, ✓, or 🎉 are multi-byte in UTF-8, and naive encoders that treat each JavaScript character as one byte corrupt them. This tool converts text to UTF-8 bytes first (via TextEncoder), so every character round-trips byte-for-byte — and decoding uses a strict UTF-8 pass that flags anything that is not genuine text.
Worked Example
Encoding the string Hello ✓ — seven characters, but nine bytes in UTF-8, because ✓ (U+2713) takes three bytes (E2 9C 93):
| Step | Detail | Result |
|---|---|---|
| 1. Text → UTF-8 bytes | Hello = 6 bytes, space = 1 byte, ✓ = 3 bytes | 9 bytes total |
| 2. Group into 3s | 9 bytes divide evenly into three groups of 3 | No padding needed |
| 3. Map each 6-bit chunk | 12 chunks → 12 alphabet characters | SGVsbG8g4pyT |
| 4. Decode to verify | Reverse the mapping, bytes → UTF-8 text | Hello ✓ — exact round trip |
Try it above: type Hello ✓ on the left and you will see SGVsbG8g4pyT appear on the right. Paste it back on the right and the check mark returns intact. Now try a naive encoder elsewhere with the same string and compare — the difference is UTF-8 done right.
Where Base64 Is Used
Once you can spot it, you see Base64 everywhere. Data URLs embed images directly in HTML and CSS — data:image/png;base64,iVBORw0KGgo… — so a page can carry its own icons with zero extra requests. Email attachments travel as Base64 inside MIME messages, a convention from the days when mail servers only promised to deliver 7-bit ASCII. HTTP Basic authentication sends username:password Base64-encoded in the Authorization header (encoded, emphatically not encrypted — see the FAQ). JSON APIs shuttle files, images, and cryptographic keys through JSON payloads that cannot hold raw binary. And JWTs — decoded by our JWT decoder — use Base64's URL-safe cousin to pack their header and payload into a token.
The pattern is always the same: binary data needs to cross a text-only bridge, and Base64 is the toll booth. It is not the most compact option (about 33% overhead) and not the fastest, but it is universal — every language ships a Base64 implementation, and every developer recognizes the alphabet on sight.
Limitations
Base64 solves a transport problem and nothing else. It is not encryption — repeating it because it matters: anyone can decode your string in one step, so never Base64-encode passwords, API secrets, or anything you would not post publicly. It inflates size by roughly a third, so it is a poor choice for large files over slow connections. There are dialects: URL-safe Base64 swaps +// for -/_ (JWTs use this), and MIME wraps lines every 76 characters — this tool speaks the standard dialect and will flag the URL-safe variant as invalid rather than guess. It cannot fix bad input: if the original text was already corrupted (mojibake from a wrong charset), encoding it just preserves the corruption faithfully. And while decoding validates UTF-8 strictly, Base64 itself carries no checksum — a single flipped character decodes to different bytes with no warning, so it is not a substitute for hashes or signatures when integrity matters.
Base64 payloads usually turn out to be JSON in a coat. Once decoded, our guide to formatting and validating JSON shows how to make the structure readable and catch the syntax error hiding in it.
Guides for This Tool
Frequently Asked Questions
What is Base64 encoding?
Is Base64 encryption?
Why does Base64 output end with = signs?
Does this tool support Unicode and emoji?
Why do I get an invalid Base64 error?
What is Base64 used for?
Related Tools
URL Encoder / Decoder
Encode URLs and components, decode percent-encoding.
JWT Decoder
Decode JSON Web Tokens and inspect expiry dates.
JSON Formatter
Format, validate, and minify JSON with syntax highlighting.
Regex Tester
Test regular expressions live with match highlighting.
Cron Expression Generator
Build cron schedules visually with plain-English descriptions.
UUID Generator Online Free
Generate bulk v1 and v4 UUIDs instantly with per-line copy — free, private, in your browser.