By Docify

Decode Base64 to UTF-8: atob

• 5 min read

To decode Base64 to readable text, use atob() and treat the bytes as UTF-8. This tool runs decodeURIComponent(escape(atob(input))) in your browser. Standard Base64 uses A-Za-z0-9+/ with = padding, not base64url. Decoding SGVsbG8gV29ybGQh writes ASCII Hello World! on /base64/. RFC 4648 §10 output foobar is Zm9vYmFy — the same bytes are MZXW6YTBOI====== on /base32/, CPNMUOJ1E8====== on /base32hex/, and 666F6F626172 on /base16/. Decode does not call String.prototype.normalize. Decoding w6k= writes NFC é (U+00E9) on /base64/. Decoding ZcyB writes NFD e + U+0301. Compose e + U+0301 to é (U+00E9) on /unicode-normalize/. The result is text only, not a binary restore. Nothing is uploaded.

A Base64 string is just bytes written with a 64-character alphabet. Decoding it is the reverse of encode — and only as useful as those bytes. The steps below match the live Base64 decoder. Try it with ASCII Hello World!: decoding SGVsbG8gV29ybGQh returns Hello World!. RFC 4648 §10 output foobar → Zm9vYmFy is the same alphabet (the sample here is different). Those same bytes are MZXW6YTBOI====== / CPNMUOJ1E8====== / 666F6F626172 on /base32/, /base32hex/, and /base16/.

How Base64 decoding works

This ASCII string encodes to the RFC 4648 line shown below. Decoding that line returns the original text. This is the text path, not FileReader.readAsDataURL.

Hello World!
SGVsbG8gV29ybGQh

How to decode Base64 in three steps

Step 1: Paste the Base64 string

Switch the tool to Decode and paste into the left-hand box. The Decode button stays disabled until that box has text. Try it with ASCII Hello World!: in Encode mode, clicking Encode writes SGVsbG8gV29ybGQh. Whitespace-only strings still count as input; a bad alphabet fails on click.

SGVsbG8gV29ybGQh

Step 2: Click Decode

Open the Docify Base64 tool and click Decode. The page runs decodeURIComponent(escape(atob(input))). Decoding SGVsbG8gV29ybGQh writes Hello World!. atob rejects characters outside the standard alphabet. The work stays in the browser.

Step 3: Read the UTF-8 text

Copy copies the text to the clipboard. Download saves it as decoded.txt (text/plain). Decoding SGVsbG8gV29ybGQh writes ASCII Hello World!:

Hello World!

What decode will and will not do

Invalid strings

Any thrown error is shown as Failed to decode: Invalid Base64 string and the result box is cleared. Typical causes: missing padding, base64url - / _, or bytes that are not valid UTF-8 after atob.

Upload on Decode

Upload file still uses FileReader.readAsDataURL and takes the payload after the comma. On Decode that payload is written into the input box. You still click Decode, which treats those bytes as UTF-8 text — not as a restored image or PDF. See Convert a file to Base64 (FileReader) for the encode-side path.

Not email or JWT tooling

The page does not parse MIME parts, extract attachments, or split a three-segment JWT. Those formats often use different wrapping or base64url. Decode only the payload you paste.

RFC 4648 output family

Hello World! is the sample; foobar is §10

The sample on /base64/ fills ASCII Hello World!; decoding SGVsbG8gV29ybGQh returns that same text. Encoding foobar on the same page writes Zm9vYmFy — the RFC 4648 §10 vector, also used on /base64url/ because it has no + or /. The same UTF-8 bytes are MZXW6YTBOI====== on /base32/, CPNMUOJ1E8====== on /base32hex/, and 666F6F626172 on /base16/.

UTF-8 Base64 is not NFC

Base64 of NFC é is w6k=; NFD e + U+0301 produces ZcyB

Text encode wraps the typed string as UTF-8 before btoa. It does not call String.prototype.normalize. Canonically equivalent é (U+00E9, UTF-8 C3 A9) and é (e + U+0301, UTF-8 65 CC 81) therefore produce different RFC 4648 strings. Decode of w6k= writes NFC é. Decode of ZcyB writes NFD e + U+0301.

Base64(NFC é) = w6k=
Base64(NFD e + U+0301) = ZcyB

Try it with ASCII Hello World!. UAX #15 output e + U+0301 → é (U+00E9) as normalized.txt is /unicode-normalize/.

Decode Base64 in the browser

Decode gives SGVsbG8gV29ybGQh → Hello World!. RFC 4648, not a binary restore. Nothing is uploaded.

Use Base64 Decoder →

FAQ

How do I decode Base64 to text?
Paste your Base64 string, click Decode. The tool uses atob() to decode, then interprets the bytes as UTF-8 text.
Does this tool upload my data?
No. All decoding runs in your browser using JavaScript. Your Base64 string is never sent to a server.
Can I decode Base64 back to a file?
This tool decodes to text only. Bytes that are not valid UTF-8 will fail or display incorrectly. Use a binary decoder for files.
Why does decoding fail with an error?
Common causes: the string contains invalid characters, is not proper Base64, or has incorrect padding. Standard Base64 uses A-Z, a-z, 0-9, +, /, and = for padding.
Is this the same as Base64URL?
No. This tool uses standard RFC 4648 Base64 with + and /. Base64URL uses - and _ instead, often without padding. JWTs use Base64URL.
Does decoding handle Unicode correctly?
Yes. The decoder treats the bytes as UTF-8, so accented characters and emoji decode correctly if they were encoded properly.

Related