Base64 Decoder
Base64 decode a value back to readable text with this Base64 decoder. Paste Base64, a data URI, or a token to decode Base64 to string output, and turn on URL safe Base64 decode when the value uses - and _ instead of + and /. The page explains how to decode Base64 and reports the exact character and position when the input is invalid Base64.
In WeChat, downloads and image copy may be blocked. If a button does not respond, tap ··· in the top-right corner and choose Open in Browser.
Input 0 B · Output 0 B
Base64 decode rebuilds the bytes behind a Base64 string, .b64 file or data URI in your browser, showing text when the bytes are readable and offering a download when they are not. Nothing is uploaded, and the page keeps working offline once loaded.
Reach for it when a webhook payload stores a token as Base64, when a QR code or 2FA setup string hides a readable secret, or when a colleague sends a .b64 attachment instead of the original document. Paste the value and the decoder returns text in the charset it can detect, or a decoded binary you can save and open elsewhere. The same step also reveals the plain text inside a signed cookie or a setup link.
How to use
- Paste the value. Paste into the input box, or load a
.txt,.b64or.base64file up to 20 MB. Whitespace and line breaks are ignored, and adata:URI is recognised rather than treated as plain Base64. - Adjust the options. The url safe base64 decode switch accepts
-and_; Charset moves from auto-detect to a specific legacy encoding; Decode each line handles logs where every line is a separate value. - Take the result. Copy the decoded text, download
decoded.txt, or use the separate panel that appears for binary output, which offers the original MIME type, a preview for images and a download named after the detected extension.
Padding, charsets and errors
A decoder can fail for three different reasons: the alphabet, the padding or the bytes themselves. This page separates those cases so the error message points at the right one.
Inside the base64 decoder
Whitespace is stripped before decoding, so a value wrapped by an email client still works. Missing padding is tolerated: SGVsbG8 and SGVsbG8= both decode to Hello. Padding that is present but wrong is not tolerated — SGVsbG8== stops with Base64 padding is invalid. — because the extra = no longer matches the remaining bytes. A length that leaves one spare character, such as a five-character body, is also rejected as invalid Base64. The same decoder accepts unpadded values from JWT libraries, which routinely strip the equals signs.
How to decode base64 to string
When Charset is set to Auto, the decoder rejects invalid UTF-8, checks for a byte-order mark, and then scores legacy candidates such as GBK, Big5, Shift_JIS, EUC-KR, Windows-1251 and Windows-1252. The detected label appears under the box, so you can confirm the guess. w6k= decodes to é as UTF-8; bytes from a Windows-1251 document show as readable Cyrillic only after that charset is picked by hand. A very short string carries too little data for a reliable guess, so a manual choice usually beats the detector.
Why invalid base64 errors include a position
The message Input is not valid Base64. Unexpected "@" at position 5. means the fifth character is outside A–Z, a–z, 0–9, + and /. A URL-safe value containing - or _ triggers the same class of error until the URL-safe switch is on, and a pasted JSON fragment usually fails on the first quote or colon. Fixing the reported character is faster than re-copying a long payload. With Decode each line enabled, the same message includes a line number, which makes a broken batch file easy to locate.
FAQ
How to decode base64?
Paste the value into the input box and the base64 decode result appears below it. Whitespace is ignored, padding is optional, and a data URI is split before decoding. If the bytes are not text, a download panel appears instead.
Why does the decoder report an invalid character?
The message names the first character outside the Base64 alphabet and its position. Copy the value again without quotes or JSON punctuation, or enable the URL-safe switch when the string contains hyphens and underscores.
Can I decode a Base64 file?
Yes. A base64 decode can start from a .txt, .b64 or .base64 file up to 20 MB, or from a pasted data URI. When the decoded bytes are binary rather than text, the panel shows the MIME type, a preview for images and a download link.
Why does the decoded text look garbled?
The bytes were probably written in a legacy charset, so the base64 decode output looks garbled. Auto-detect covers GBK, Big5, Shift_JIS, EUC-KR, Windows-1251 and Windows-1252, but a manual choice is more reliable when the sample is short or mixes languages.
Is my Base64 data uploaded?
No. The decoder runs entirely in your browser, the value stays in memory, and the download is built from a local blob. Nothing is sent to a server or saved after you close the tab.
Related tools
When the payload is text rather than a file, Base64 to Text strips the extra decoding steps and shows only the string. Base64 to Image is the better stop for picture data URIs, with zoom and a preview. Base64 to PDF checks the %PDF signature before saving. Base64 Converter keeps encode and decode side by side when you need to compare a base64 decode with its source, and it is the quickest way to confirm a result.