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:

  1. 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.
  2. 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.
  3. Watch the stats. Below the buttons, the tool shows both lengths and the size overhead — a quick reminder that Base64 costs about 33% extra.
  4. 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.

3 bytes (24 bits) → 4 Base64 characters (4 × 6 bits)

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:

output length = 4 × ceil(input bytes ÷ 3)

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):

StepDetailResult
1. Text → UTF-8 bytesHello = 6 bytes, space = 1 byte, ✓ = 3 bytes9 bytes total
2. Group into 3s9 bytes divide evenly into three groups of 3No padding needed
3. Map each 6-bit chunk12 chunks → 12 alphabet charactersSGVsbG8g4pyT
4. Decode to verifyReverse the mapping, bytes → UTF-8 textHello ✓ — 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?
Base64 is a way to represent binary data as plain text using 64 characters: A–Z, a–z, 0–9, plus + and /. It regroups every 3 bytes (24 bits) into 4 six-bit chunks, each mapped to one character. Output runs about 33% longer than the input, and survives email, URLs, JSON, and anywhere else that tolerates plain text.
Is Base64 encryption?
No — and this is the most important thing on this page. Base64 is an encoding, not encryption: anyone can reverse it in one step with no key or password. Never use Base64 to hide passwords, tokens, or anything sensitive. It protects data against mangling by text-only systems, not against prying eyes.
Why does Base64 output end with = signs?
Those are padding. Base64 processes input in 3-byte groups, and if the input length is not a multiple of 3, the last group is padded with one or two = characters to keep the output a multiple of 4 characters. They carry no data — they just mark where the real content ended.
Does this tool support Unicode and emoji?
Yes. Text is first converted to UTF-8 bytes with the TextEncoder API, so every character — accented letters, Chinese, Arabic, emoji like ✓ and 🎉 — encodes correctly and decodes back byte-for-byte. Many older tools only handle Latin-1 and silently corrupt anything else; this one does not.
Why do I get an invalid Base64 error?
Base64 only allows A–Z, a–z, 0–9, +, /, and up to two = padding characters at the very end. The usual culprits are stray whitespace or line breaks from copying, URL-safe Base64 (which uses - and _ instead of + and /), or a truncated string. This decoder ignores whitespace automatically and tells you exactly what looks wrong otherwise.
What is Base64 used for?
Everywhere binary data must travel through text-only channels: embedding images in HTML and CSS as data URLs, email attachments (MIME), HTTP Basic authentication headers, JSON API payloads carrying files, and data URIs in SVG. If you have ever seen a very long string starting with data:image/png;base64, — that is Base64 at work.

Related Tools