Paste a Base64 string and read what is inside it. Decoding is UTF-8 aware, so accented letters and emoji come back as themselves instead of mojibake (the garbled text you get when bytes are read with the wrong encoding). The string is decoded in this page, so nothing is uploaded.
SGVsbG8gV29ybGQhClRoaXMgaXMgYSB0ZXN0IGZvciBCYXNlNjQgRGVjb2Rlci4= Hello World!
This is a test for Base64 Decoder. Decode the payload before you debug the code. Payloads, certificates and file contents often arrive Base64-encoded. Reading the decoded value tells you whether the problem is the data or the encoding.
An Authorization: Basic header is base64(user:password). Decode it to see which account a request used. For example, dXNlcjpwYXNz decodes to user:pass.
const encoded = "SGVsbG8sIHfDtnJsZCEg8J+MjQ==";
// Node.js: decode to bytes, then to a UTF-8 string
const text = Buffer.from(encoded, "base64").toString("utf8");
console.log(text); // Hello, wörld! 🌍
// Browser: atob() returns a "binary string", so convert bytes to UTF-8
const binary = atob(encoded);
const bytes = Uint8Array.from(binary, (c) => c.charCodeAt(0));
console.log(new TextDecoder().decode(bytes));
// URL-safe input without padding
console.log(Buffer.from("SGVsbG8sIHfDtnJsZCEg8J-MjQ", "base64url").toString()); Node's Buffer is lenient: it ignores whitespace and missing padding. atob() is strict about padding and throws on invalid input.
<?php
$encoded = "SGVsbG8sIHfDtnJsZCEg8J+MjQ==";
// Strict mode returns false on characters outside the Base64 alphabet
$text = base64_decode($encoded, true);
if ($text === false) {
die('Invalid Base64 input');
}
echo $text, PHP_EOL; // Hello, wörld! 🌍
// Accept URL-safe input: restore + and /, then re-add padding
$urlSafe = "SGVsbG8sIHfDtnJsZCEg8J-MjQ";
$std = strtr($urlSafe, '-_', '+/');
$std .= str_repeat('=', (4 - strlen($std) % 4) % 4);
echo base64_decode($std, true), PHP_EOL; Without the second argument, base64_decode silently skips invalid characters, which can hide corrupted input.
import base64
import binascii
encoded = "SGVsbG8sIHfDtnJsZCEg8J+MjQ=="
try:
text = base64.b64decode(encoded, validate=True).decode("utf-8")
except (binascii.Error, UnicodeDecodeError) as e:
raise SystemExit(f"Cannot decode: {e}")
print(text) # Hello, wörld! 🌍
# URL-safe input without padding: add "=" until the length is a multiple of 4
url_safe = "SGVsbG8sIHfDtnJsZCEg8J-MjQ"
padded = url_safe + "=" * (-len(url_safe) % 4)
print(base64.urlsafe_b64decode(padded).decode("utf-8")) Decoding gives you bytes. The same Base64 string could be UTF-8 text, a PNG or an encrypted blob, and nothing in the encoding says which. However, the first few characters usually tell you: iVBORw0 is a PNG, /9j/ is a JPEG, eyJ is a JSON object and H4sI is gzip.
Base64 is not encryption, even though the output looks like noise. There is no key, and anyone can reverse it in one line. Treat a Base64 password in a config file or a JWT payload as a plain-text password.
This tool follows the specifications below. Read them when you need the exact normative wording, for example to settle an edge case between two implementations.
The bytes are probably not UTF-8 text. They may be binary data (paste an image into Base64 to Image) or text in another encoding such as Latin-1, in which case check what the sender used.
Yes. The decoder maps - and _ back to + and / and restores missing = padding before decoding, so a JWT segment or a base64url token pastes as it is. A data: URL prefix is stripped too.
You can, since each segment is base64url. The JWT Decoder does all three segments in one step and pretty-prints the header and payload as JSON.
A character outside both Base64 alphabets, most often surrounding quotes, a trailing comma or part of a JSON field that came along with the copy. Spaces, line breaks, a data: prefix and URL-safe - and _ are all handled, so paste the encoded value and drop the rest.
No. Decoding uses the browser's built-in atob() function in this tab, so nothing leaves your device.
Encoding instead of decoding is the Base64 encoder. If the decoded bytes turn out to be an image, Base64 to Image will render it, and Image to Base64 handles the reverse trip.