Home › Ciphers › Base64 Decode
Base64 Decode
You have met a string of capitals, lowercase letters and digits, probably ending in one or two = signs — in an email header, an API response, a token, a puzzle — and you want to know what it says. Paste it here: the decoder turns it back into text instantly, and when the string is not Base64 it tells you exactly why it cannot be, instead of handing you garbage.
Base64 is a binary-to-text encoding (RFC 4648): it rewrites bytes as 64 safe characters — A–Z, a–z, 0–9, + and / — three bytes becoming four characters, with = padding closing the last group. It hides nothing: there is no key, and anyone can decode it. That openness is the point — Base64 exists to carry bytes safely through text-only channels, not to keep secrets.
If your string decodes into more scrambled text, there is another layer inside — hand it to the Cipher Solver, which chains layers automatically. Not sure the string is Base64 at all? The Cipher Identifier will name the format.
Decode Base64, or encode text
Everything runs in your browser — nothing is uploaded.
Three bytes in, four characters out
A byte is 8 bits; a Base64 character carries 6. The least common multiple of 8 and 6 is 24, so the encoding works in blocks of 24 bits: take three bytes, lay their bits end to end, re-slice them into four groups of six, and write each 6-bit value (0–63) as the character at that position in the alphabet. Decoding runs the film backwards — characters to 6-bit values, bits back into bytes, and the bytes read as UTF-8 text.
One block, walked through: “Man” → TWFu
| Step | What happens |
|---|---|
| Bytes | M = 77, a = 97, n = 110 |
| Bits | 01001101 01100001 01101110 |
| Re-sliced in sixes | 010011 · 010110 · 000101 · 101110 |
| Values | 19 · 22 · 5 · 46 |
| Characters | T · W · F · u → TWFu |
This is the example the specification tradition uses, and the tool above reproduces it exactly — type Man in Encode mode and TWFu is what comes back.
Padding: why the = signs are there
Real messages rarely end on a multiple of three bytes. When the last block is short, the missing bytes are imagined as zero bits for the slicing, the characters that contain no real data are replaced by =, and the count of = signs tells the decoder exactly how many bytes to drop:
| Bytes left in the last block | Encoded ending | Example |
|---|---|---|
| 3 (a full block) | 4 characters, no padding | foo → Zm9v |
| 2 | 3 characters + one = | fo → Zm8= |
| 1 | 2 characters + two = | f → Zg== |
Two consequences are worth remembering. A Base64 string's length is always a multiple of four — if yours is not, something was lost in copying. And the encoding is exactly one third larger than the data: four characters carry three bytes, a 33% tax for safe transport.
Built for email, standardised in RFC 4648
Base64 was born from a transport problem. The email system of the 1980s and early 1990s moved 7-bit ASCII text; a photograph, a program or even an accented letter contains bytes outside that safe range and could be mangled in transit. The fix was to re-express arbitrary bytes using only characters guaranteed to survive — letters, digits and a couple of symbols. A scheme of this shape appeared in Privacy-Enhanced Mail in the early 1990s and was taken up by MIME, the standard that lets email carry attachments; the current, canonical specification is RFC 4648 (2006), which fixes the alphabet, the padding rules and the URL-safe variant.
The name is simply descriptive: the alphabet has 64 characters, so each character is one base-64 digit. Base64 had ancestors — uuencode carried files over Usenet in the 1980s with a similar trick — but MIME's reach made Base64 the version the whole internet ended up speaking.
- 1980s — uuencode and similar schemes carry binary files over text-only networks.
- Early 1990s — the 64-character scheme appears in Privacy-Enhanced Mail, then in MIME email.
- 2006 — RFC 4648 publishes the definitive specification, including the URL-safe alphabet.
- Today — attachments, data URIs, API payloads and web tokens all ride on it.
The 64-character alphabet, with values
Every character's value is its position. A–Z take 0–25, a–z take 26–51, the digits take 52–61, and + and / close the set at 62 and 63. The grid below is generated from the same alphabet table the tool uses, so the two can never disagree.
Recognising Base64 in the wild: a mix of upper case, lower case and digits with no spaces, a length divisible by four, and — about two times in three — one or two = signs at the very end. A string that starts memorably is often a file in disguise: /9j/ begins a JPEG, iVBORw a PNG, JVBERg a PDF, UEsDB a ZIP, R0lGOD a GIF — those are the encodings of the file formats' first bytes.
Verified against the specification
Example 1 — the RFC 4648 test vectors
These seven pairs are printed in RFC 4648 itself as the conformance test for encoders. Watch the padding cycle as the input grows a byte at a time: ==, =, none, ==, =, none. The tool above reproduces all seven exactly — they are part of its test suite.
Example 2 — decoding a sentence
Sixteen characters make four complete groups, so the decoder reads twelve bytes out — except that the single = trims the last group to two real bytes, giving eleven: h e l l o (space) w o r l d. A quick sanity test for any suspected Base64 string: change one character in the middle and the text garbles only locally, because each group of four decodes independently of its neighbours.
Example 3 — when the payload is not text
Feed the tool a JPEG's opening bytes and it says so, rather than printing byte-soup: the decode is perfectly valid Base64, but the payload was always binary. The first bytes name the file type — that is what the prefixes in the Reference section are.
Four failure shapes, four different causes
This decoder names its errors deliberately, because each failure shape points at a different fix. Silent garbage would help no one — a mistyped or mis-copied string should fail loudly and say where.
| What you see | Likely cause | Fix |
|---|---|---|
| A character “never appears in the Base64 alphabet” | A truncated paste, or text that was never Base64 — a hash, or a token in another format | Re-copy the whole string; if it still fails, run it through the Identifier instead of guessing |
| “A final group of a single character is impossible” | One character lost at a line wrap or selection edge | Paste again including the very end — the = signs matter |
| “Decoded to bytes, but they aren't readable text” | The payload was binary all along — an image, a zip, a protobuf | Nothing is broken: Base64 carried bytes, not words. The tool names the file type when the first bytes give it away |
| It decoded — to more unreadable text | Double encoding, or another layer (hex, a cipher) inside | Decode the output again, or hand the whole thing to the Cipher Solver, which chains layers automatically |
- Security status: none whatsoever. Base64 is a public encoding with no key; treat anything Base64'd as printed in clear.
- What gives it away: the restricted alphabet, the multiple-of-four length, the = ending.
- The one real secret-keeping failure: people mistaking encoding for encryption — passwords and tokens “protected” by Base64 are protected not at all.
URL-safe, unpadded, and the base-N family
| Variant | How it differs | Where you meet it |
|---|---|---|
| URL-safe Base64 | − replaces +, _ replaces /, so the string survives inside a web address; padding is often dropped entirely | Links, JWT web tokens, API keys. This decoder translates it automatically and tells you it did |
| Unpadded | The = signs omitted; the decoder re-derives them from the length | Tokens and compact formats. Accepted here when the length allows it |
| Data URI | Base64 glued to a MIME type: data:image/png;base64,… | Images embedded directly in web pages and emails — strip the prefix, decode the rest here |
| Base32 / Base58 / Base85 | Sibling encodings with different alphabet sizes — 32 (no lowercase), 58 (no look-alike characters), 85 (denser) | Base32 in authenticator secrets, Base58 in Bitcoin addresses. Different tools — the Identifier separates them |
The relatives on this site: hex spends two characters per byte where Base64 spends four per three, binary spends eight, and Morse is the variable-length ancestor of the whole idea — a code designed so common letters cost the least.
Where Base64 actually lives
Every email attachment you have ever received travelled as Base64 inside MIME. Every data: image embedded in a web page is Base64. The three-part tokens that keep you logged in to web apps (JWTs) are URL-safe Base64 segments joined by dots — decode the first two segments of one and you can read the header and payload with your own eyes, which is a fine party trick and a standing lesson in why tokens must be signed, since they cannot be hidden. Programmers meet Base64 in API payloads, embedded fonts, certificates (PEM files are Base64 between BEGIN and END lines) and environment variables. Puzzle designers and CTF authors love it as the outer layer: recognisable enough to reward the solver who spots it, transparent enough to hand them cleanly to the real cipher underneath — which is exactly the chain the Cipher Solver automates.
Two strings to decode
Try them in the tool first — then check yourself here.
Practice 1
Reveal the answer
“Attack at dawn!” — 16 characters with no padding: the message was exactly 12 bytes, so no = was needed.
Practice 2
Reveal the answer
“Meet me at the park at noon” — again unpadded (27 bytes, a multiple of three). Spot the giveaway before decoding: the length is a multiple of four and the alphabet is restricted.
The printable cipher cheat sheet keeps the Base64 alphabet and the other encodings on one page for puzzle kits and classrooms.
Base64 is this page. The neighbours:
Frequently asked questions
Is Base64 a form of encryption?
No. Encryption needs a key; Base64 has none — the alphabet and rules are public, fixed by RFC 4648, and anyone can decode any Base64 string, as this page just did. Base64 changes how bytes are written, not who can read them. Never treat a Base64'd password or token as protected.
Why is the encoded text longer than the original?
Because each character carries only 6 bits of the 8 in a byte. It takes four characters to move three bytes, so the output is exactly one third longer, plus up to two padding characters. That 33% is the price of using only characters that survive any text channel.
What do the = signs at the end mean?
Padding. They announce that the final block held fewer than three bytes: one = means two real bytes in the last group, two = means one. They carry no data — they exist so the decoder knows how many bytes to drop, and so the total length stays a multiple of four.
My string decoded to gibberish. What went wrong?
Probably nothing. Either the payload was binary all along (an image or archive — the tool names the file type when it can), or there is another layer inside: the output of one decoding is the input to the next. The Cipher Solver follows those chains automatically.
What is URL-safe Base64, and why do tokens use it?
The standard alphabet's + and / are dangerous inside a web address, so the URL-safe variant (also in RFC 4648) spells them − and _, and usually drops the padding. It is the form used by JWT login tokens and many API keys. This page detects and translates it automatically.
Does my text leave my device?
No. The decoding, encoding and alphabet grid all run in your browser — paste a token here and it goes nowhere.