Base64 Decode & Encode

Decode Base64 back to readable text – or convert Base64 to an image, PDF or other downloadable file when it contains binary data – and encode any text to Base64. Unicode is handled as UTF-8.

0 chars
0 chars

Options

Changes apply instantly.

How Base64 decoding works

Text or binary

If the decoded bytes are valid UTF-8 text they are shown directly. Images, PDFs and other binary data are detected and offered as a file download.

Forgiving input

Whitespace and line breaks are ignored, missing = padding is added, and data: URL prefixes are stripped automatically.

URL-safe Base64

Base64URL – used in JWTs and URLs – replaces + and / with - and _. Both variants are decoded without any settings.

UTF-8 encoding

Text is converted to UTF-8 bytes before encoding, so æ, ø, å, Arabic and emoji round-trip correctly.

Base64 examples

Base64 turns every 3 bytes into 4 characters from the alphabet A–Z a–z 0–9 + /. When the input isn't a multiple of 3 bytes, = pads the output to a multiple of 4 characters.

InputBase64Notes
abcYWJj3 bytes become exactly 4 characters – no padding.
helloaGVsbG8=5 bytes: one = of padding.
hiaGk=2 bytes: one = of padding.
øw7g=Encoded as its two UTF-8 bytes, C3 B8.
bytes FB FF+/8=Standard Base64 – the URL-safe form is -_8.

Recognize a file from its Base64

Files start with fixed "magic bytes", so their Base64 starts with a recognizable prefix. The decoder uses these signatures to name the downloaded file with the right extension.

Base64 starts withFile typeDownloads as
iVBORw0KGgoPNG imagedecoded.png
/9j/JPEG imagedecoded.jpg
R0lGODGIF imagedecoded.gif
JVBERi0PDF documentdecoded.pdf
UEsDBZIP archive (also .docx, .xlsx, .jar)decoded.zip
H4sIgzip archivedecoded.gz
anything elseOther binary datadecoded.bin

Frequently asked questions

How do I decode a Base64 string?

Paste the Base64 string into the left field. The decoded text appears instantly on the right. If it contains binary data, use the download button to save it as a file.

Why do I get an invalid Base64 error?

Base64 only uses A–Z, a–z, 0–9, + and / (or - and _), plus = padding at the end. Any other character, or a truncated string, makes it invalid.

Is Base64 encryption?

No. Base64 is an encoding, not encryption. Anyone can decode it, so never use it to protect passwords or other secrets.

How do I convert Base64 to an image or PDF?

Paste the Base64 string or the complete data: URL. When the decoded bytes are a PNG, JPEG, GIF, PDF, ZIP or gzip file, the tool says so and the Download file button saves it with the right extension. To go the other way, use the Base64 file encoder.

Can I decode a JWT with this tool?

Yes, one part at a time. A JWT is three Base64URL strings separated by dots: header, payload and signature. Paste the middle part to read the payload as JSON. Decoding does not verify the signature, so never trust a token just because it decodes.

Why does Base64 end with = or ==?

That is padding. Base64 works on groups of 3 bytes; if the last group has only 1 or 2 bytes, the output is filled up with == or =. URL-safe Base64 usually leaves it out, and this decoder accepts both.