Skip to content
Tools

Base64 Decoder

Decode Base64 encoded text instantly into readable content with automatic format detection and preview. Everything runs locally in your browser.

Visible pane

Paste Base64 text or upload a file to decode.

Waiting for input

Everything happens locally in your browser. Your data is never uploaded.

What is Base64 decoding?

Decoding Base64 means turning those 64 printable characters back into the bytes they stand for. It is the exact reverse of encoding, and it is lossless: the bytes that come out are the bytes that went in.

The interesting part is what happens next. Base64 carries no type information — it is a way of spelling bytes, not a container — so a decoder gets back a pile of bytes with nothing to say whether they are a sentence, a JSON document or a PNG. Working that out is what separates a useful decoder from a text box.

Base64
TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu
Decoded
Many hands make light work.

That example is text. Feed the same decoder the contents of a data URI and the bytes will begin 89 50 4E 47 — the signature every PNG starts with — at which point showing you the picture is far more useful than showing you the mojibake those bytes make when read as characters.

How Base64 decoding works

Encoding takes 24 bits at a time — three bytes — and re-cuts them into four six-bit groups, each of which picks a character. Decoding runs that backwards: four characters become four six-bit values, which join into 24 bits, which split into three bytes.

"TWFu"  →  19, 22, 5, 46  →  010011 010110 000101 101110         →  01001101 01100001 01101110  →  77, 97, 110  →  "Man"

Padding is what handles input that did not divide evenly. One = means the final group carried two bytes; two mean it carried one. The padding contributes no data of its own — it exists so the length is always a multiple of four.

Three things routinely go wrong, and each has its own message here:

  • A character outside the alphabet. Usually a value that was truncated, copied along with the text around it, or percent-encoded in transit — run it through the URL decoder first if you see %2B or %2F in it.
  • Padding in the wrong place. Almost always two separate values concatenated — decode them one at a time.
  • An impossible length. Base64 can never have exactly one character left over after groups of four, so characters are missing from the end.

Two variations are accepted without being asked about. The URL-safe alphabet uses - and _ where the standard one uses + and /; since neither pair can appear in the other, accepting both is never ambiguous. And padding is optional, because JWTs drop it — paste a whole token into the JWT decoder instead and it splits the three segments for you.

Finally, the bytes are tested against UTF-8. If they decode cleanly, the result is text; if they do not, it is a file — and that answer decides which views the tool offers you.

Supported output formats

The detected format is named before anything is rendered, so you always know what the tool thinks it is looking at.

Text

Bytes that decode as valid UTF-8 and match none of the other shapes. Shown as-is, with search over the content and a .txt download.

JSON

Detected by parsing rather than guessing, then pretty printed with syntax highlighting. The most common thing anyone decodes, largely because of JWTs.

XML

Detected from a declaration or a root element and re-indented for reading. Comments, CDATA and processing instructions are preserved exactly.

HTML

Two views: the formatted source, and the page rendered in a sandboxed frame with scripts disabled — so you can see what it looks like without running it.

Images

PNG, JPEG, GIF, WebP, BMP, ICO and SVG are recognised from their signature and previewed directly, with a download under the correct extension.

Binary files

PDFs, archives, audio and anything unrecognised are reported with their size, MIME type and a hex dump of the opening bytes, plus a download that gives you the file itself.

Detection is ordered by how certain it can be. A file signature is a fact — the eight bytes that open a PNG are defined by the format — so those are checked first, and they win even when the bytes happen to decode as text. Text shapes are judgements, so each check is conservative: JSON has to parse, and CSV needs at least two rows that agree on their delimiter count, because prose contains commas too.

How to decode Base64

  1. 1. Add the Base64. Paste it into the left panel, drop a file anywhere on the tool, or use the upload button. Line breaks, spaces and missing padding are all fine — they are ignored.
  2. 2. Check the status bar. It reads Decoded along with the detected MIME type and size. If the input is not valid Base64, it names the problem, its line and column, and offers a button that jumps the cursor there.
  3. 3. Look at the detected format. The badge above the output says what the bytes turned out to be. That is what decides whether you get a rendered page, an image, formatted source or a hex dump.
  4. 4. Switch views. HTML offers rendered and source; text formats offer the formatted content; binary offers the summary and dump. Statistics is always available.
  5. 5. Take the result. Copy the text, or download the file — the download writes the decoded bytes under the extension the detection worked out, so a decoded PNG saves as a working .png. The MIME type lookup goes the other way when you have the media type and need the extension.

For a long document, press Ctrl+F (Cmd+F on a Mac) to search the decoded content rather than scrolling it. Matches are highlighted and counted, and the arrows step through them.

Common use cases

Base64 turns up wherever bytes have had to travel through something that only carries text — and decoding is how you find out what they were.

API responses

Binary fields inside JSON payloads — thumbnails, signatures, certificates — arrive Base64 encoded because JSON has no type for raw bytes. Decoding shows what actually came back.

JWT tokens

A JWT's payload is URL-safe Base64. Decoding it shows the claims, and demonstrates the thing worth remembering: anyone holding the token can read them.

Images and data URIs

A data: URI in CSS or HTML is Base64 with a prefix. Paste the payload and the image appears, which is far quicker than saving it and opening a file.

Email attachments

MIME encodes every attachment as Base64, wrapped at 76 columns. Line breaks are ignored here, so a value copied straight out of a raw email decodes as it stands.

Web development

Basic auth headers, integrity hashes, CSP nonces and session values all pass through Base64. Decoding one is usually the fastest way to see whether it contains what you expected.

Debugging

When an encoded value fails somewhere downstream, decoding it locally tells you whether the problem is the data or the transport — and the error messages name exactly which character broke it.

Base64 encoding vs decoding

They are exact inverses, and the asymmetry between them is not in the arithmetic — it is in what can go wrong.

Encoding never fails. Every possible sequence of bytes has a Base64 representation. Give an encoder anything and it produces valid output.

Decoding can fail, because not every string is valid Base64. That is why a decoder needs the error messages an encoder does not: a wrong character, bad padding, an impossible length. It is also why a decoder benefits from format detection and an encoder does not — the encoder was handed something whose type the caller already knew.

The practical differences:

  • Direction of size. Encoding grows data by about a third; decoding shrinks it by about a quarter, back to the original.
  • Certainty. Encoding always succeeds. Decoding validates first, and says precisely where the input stopped making sense.
  • What you get back. Encoding always yields text. Decoding might yield text, or might yield a PNG — which is why this tool works out which before deciding how to show it.

One thing they share, and it is the thing most worth knowing: neither is encryption. Base64 has no key. Anyone holding an encoded value can decode it in seconds — this page will do it for them. Treat encoded data exactly as you would treat the original.

Going the other way? The Base64 Encoder handles text and files, with URL-safe output and MIME line wrapping.

Frequently asked questions

Is this Base64 decoder free?

Yes. Decoding, format detection, every preview, the statistics, search and downloads are all free, with no account, no usage cap and no paid tier. Nothing is held back.

Is my data uploaded anywhere?

No. Everything happens inside your browser. The Base64 you paste and the files you open are decoded by JavaScript running on your own machine — nothing is sent over the network, stored or logged. You can confirm this by watching your browser's network panel, or by disconnecting from the internet after the page loads: the decoder keeps working.

Can I decode images?

Yes, and they are shown rather than described. PNG, JPEG, GIF, WebP, BMP, ICO and SVG are all recognised from their file signature and rendered as a preview, with a download button that saves the real bytes under the right extension. This is what makes the tool useful for data URIs pulled out of CSS or HTML.

Can I decode JSON?

Yes. JSON is detected by actually parsing it, not by guessing from the first character, and the result is pretty printed with syntax highlighting. It is the quickest way to read a JWT payload or an encoded API response.

Can I decode XML and HTML?

Yes. XML is detected and re-indented so the structure is readable. HTML gets two views: the source, formatted, and a rendered preview of the page itself. The preview runs in a sandboxed frame with scripts disabled, so decoding a page someone sent you cannot run their code.

How does the format detection work?

Binary formats are identified by their signature — the fixed bytes every format starts with, such as the eight that begin a PNG. That is reliable. Text formats are identified by shape: JSON has to parse, HTML needs a doctype or an <html> root, XML needs a declaration or an element, and CSV needs at least two rows agreeing on their delimiter count. Each check is deliberately conservative, and the detected format is named before anything is rendered.

Can I download decoded files?

Yes, and the download always writes the decoded bytes rather than the text on screen — for an image or a PDF those are very different things. The extension is chosen from the detected format, so decoding a PNG gives you a .png and decoding a JSON document gives you a .json.

Does it support Unicode?

Yes. Bytes are decoded as UTF-8, so accented letters, CJK characters, Cyrillic and emoji all come back exactly. Tools built on the browser's older atob function mangle these, because atob works one byte at a time and knows nothing about multi-byte characters.

What does it mean when it says the result is binary?

That the decoded bytes are not valid UTF-8 text — which is normal and expected for an image, a PDF or an archive. It is not an error: the Base64 was perfectly well formed. The bytes are intact and the download gives you the real file; only the text view has nothing sensible to show.

Can I decode large Base64 strings?

Yes. Input up to roughly 20 MB is supported, and a megabyte decodes in about ten milliseconds. Decoding runs off the keystroke path so typing stays responsive, and a large binary result is summarised with a hex dump rather than being rendered in full.

Why does my Base64 fail to decode?

Usually one of three things: a character outside the alphabet, which normally means the value was truncated or copied with surrounding text; padding in the wrong place, which usually means two values were concatenated; or a length that cannot be right, which means characters are missing from the end. The tool names which of the three it found and points at the exact line and column.

Does it handle URL-safe Base64 and missing padding?

Yes, without being told. Both alphabets are accepted — the standard + and / and the URL-safe - and _ — and padding is optional in both directions. That matters because JWTs use the URL-safe form with the padding stripped, and pasting one straight in should simply work.

Can I decode a JWT with this?

You can decode its segments. A JWT is three URL-safe Base64 strings joined by dots; paste the middle one and you get the claims as readable JSON. Worth knowing what that demonstrates: a JWT payload is encoded, not encrypted, so anyone holding the token can read it. The signature proves it has not been altered, not that it is private.

Is decoding Base64 safe?

Decoding itself is just arithmetic. The care needed is in what you then do with the result: this tool renders decoded HTML in a sandboxed frame with scripts disabled and no access to the page precisely because a decoded document is untrusted content. Treat anything you decode from an unknown source the same way you would treat a file from that source.

Does the decoder work offline?

Once the page has loaded, yes. All decoding and detection is local, so you can disconnect and keep working. A connection is only needed to load the page in the first place.

Popular tools

↑ ↓NavigateOpenEscClose