Base64 Decode
Paste Base64 to read it, or text or a file to encode it. Nothing leaves your browser.
- 0
- Characters
- 0
- Bytes
- 0
- Errors
On this page
About Base64 Decode
Updated
What is a Base64 decoder?
A Base64 decoder turns Base64 text back into the bytes it holds. Those bytes can be text, such as JSON or an email, or a file, such as an image, a PDF or a certificate. This tool decodes and encodes, and shows what the bytes are.
How to use this tool
This Base64 converter works both ways. Paste Base64 and it decodes as you type. The Text view shows decoded text. When the bytes are a file, such as an image, a PDF or a ZIP, the File view names its type, shows images, and saves the real file. Hex shows every byte. Summary lists the alphabet, the padding and the size.
To encode, type or paste text and press Encode (Alt E). The editor then holds the Base64, and the Result decodes it again, so you can see it is right. Undo brings your text back. To encode a file, drop it on the editor or press File.
What it reads
Decode reads standard Base64 and Base64URL, with or without = padding. It skips line breaks and spaces, a Basic or Bearer word copied from an Authorization header, the data:image/png;base64, part of a data URI, and the BEGIN and END lines of a PEM certificate or key, also when OpenSSL wrote text before them. Paste a whole JSON Web Token and the card offers Open in JWT Decoder, which decodes all three parts. You can also go to the JWT Decoder directly.
Customization
Charset sets how decoded bytes read as text. Auto, the default, finds UTF-8, UTF-16LE (as PowerShell writes it) or Windows-1252 by itself. You can also set UTF-8, ISO-8859-1, Windows-1252 or UTF-16LE. For Encode, choose the alphabet (Standard or Base64URL), whether to end with =, and one line or 76-character lines as in email.
Common Base64 errors
A character that is not Base64
A bad copy or a typing mistake leaves a character that Base64 does not use. Most decoders only say the input is invalid. This one rings the character and names its line and column.
VGhlIHF1aWNrIGJyb3duIGZveCBqdW!wcyBvdmVyRemove the character or put back the one you meant:
VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyBase64 copied from a URL
In a URL, +, / and = are often written as %2B, %2F and %3D, and a + can become a space. The error card has a URL-decode it button that puts the characters back. Undo brings the old text back.
eyJyZXR1cm4iOiIvY2FydCIsInN0ZXAiOjEyfQ%3D%3DeyJyZXR1cm4iOiIvY2FydCIsInN0ZXAiOjEyfQ==Wrong padding
The number of = at the end follows from the length. Two characters in the last group need ==, three need =. A missing = is read anyway, but a wrong one is an error.
SGVsbA=SGVsbA==Text that is not Base64
Words with spaces between them are plain text, not Base64. The tool says so and does not show garbage. To make Base64 from that text, press Encode this text in the card, or the Encode button.
How Base64 works
RFC 4648 defines Base64. It takes 3 bytes (24 bits) at a time and splits them into four 6-bit numbers. Each number from 0 to 63 picks one character. So 3 bytes become 4 characters, and the text is about 33% bigger than the data.
Standard Base64 and Base64URL
Standard Base64 uses + and / for 62 and 63. Those characters mean something in a URL, so Base64URL uses - and _ instead and often leaves out the padding. JWTs, many API tokens and file names use Base64URL.
Where you meet Base64
- Data URIs put images and fonts inside HTML and CSS.
- Email sends attachments in Base64, in lines of 76 characters.
- PEM files hold certificates and keys as Base64 between BEGIN and END lines.
- HTTP Basic auth sends
name:passwordin Base64. That is not a secret: anyone can decode it. - JSON Web Tokens are three Base64URL parts with dots between them.
Other Base64 resources
- RFC 4648: Base16, Base32 and Base64The standard for Base64 and Base64URL, with the alphabets, the padding rules and test vectors.
- MDN: Base64Base64 in the browser: atob(), btoa() and the problem with Unicode text.
- MDN: Uint8Array.fromBase64()The newer JavaScript way to decode Base64 and Base64URL to bytes.
- MDN: data: URLsHow to put a file inside HTML or CSS as data:type;base64,...
- RFC 2045: Base64 in email (MIME)Where the 76-character lines in email come from.
- RFC 7468: PEM text encodingsThe BEGIN and END lines around certificates and keys, and the Base64 between them.
- Wikipedia: Base64History, variants and a worked example of the encoding, bit by bit.
Base64 Decode FAQ
What is Base64 encoding?
Base64 writes any bytes with 64 safe characters: A to Z, a to z, 0 to 9, + and /. Each group of 3 bytes becomes 4 characters, so the text is about a third bigger than the data. It lets binary data, such as an image or a key, travel through systems that only carry text: email, JSON, URLs and HTML.
How do I decode Base64?
Paste it in the editor. It decodes as you type, and the Result shows the text, the file or the bytes in hex.
In code: atob() in a browser (ASCII only; for UTF-8 use Uint8Array.fromBase64() and a TextDecoder), base64 -d in a terminal, base64.b64decode() in Python and Buffer.from(s, 'base64') in Node.js.
What does == mean at the end of Base64?
It is padding. Base64 works in groups of 4 characters. When the data does not fill the last group, = fills it: one = when the last group holds 2 bytes, == when it holds 1 byte. The padding carries no data. Base64URL, used in JWTs and URLs, often leaves it out, and this tool reads it with or without.
How do I decode a Base64URL string?
Paste it as it is. Base64URL uses - and _ instead of + and /, and often has no = at the end. This tool reads both alphabets without a setting. To decode it by hand, change - to + and _ to /, add = until the length is a multiple of 4, then decode it as standard Base64.
Is Base64 encryption? Is it safe?
No. Base64 is an encoding, not encryption: anyone can decode it, with no key. Do not use it to hide passwords or secrets. A Basic auth header or a JWT payload is readable by anyone who sees it. To protect data, encrypt it, and send it over HTTPS.
Is my data sent to a server?
No. Decoding, encoding and the file preview all run in your browser. Your text and files never leave your device, and nothing is put in the URL. Some popular Base64 sites send your text to their server when you press Decode.
Why does my decoded text show strange characters?
The bytes were read in the wrong charset. Text such as Räksmörgås is UTF-8 read as ISO-8859-1. Charset Auto, the default, tries UTF-8, then UTF-16LE, then Windows-1252, and Summary says which one it used. If the text still looks wrong, choose another Charset in the Result header or in Options. When the data is not text at all (an image, a ZIP), the tool shows it in the File and Hex views instead.
How do I convert Base64 to an image or a file?
Paste the Base64. When the bytes are a file, the File view names the type (PNG, JPEG, PDF, ZIP and more), shows images, and Download saves the real file. A data:image/png;base64, prefix is read too.
The other way works too: drop an image or any file on the editor, or press File. The editor then holds its Base64. To use it in HTML or CSS, press Copy as data URI in the File view: that gives data:image/png;base64,... with the right type.
Is Base64 encoding still used?
Yes, every day. Email sends attachments in Base64. Web pages put small images and fonts in data URIs. JSON Web Tokens, HTTP Basic auth, PEM certificates and keys, and many APIs that carry files in JSON all use it. It is old, but nothing has replaced it for putting bytes into text.
Can ChatGPT decode Base64?
Often, for short text, but it can make mistakes, and it cannot give you back a file. It also sends what you paste to a server. Base64 is often a token, a key or a password, so that matters. This tool decodes exactly, shows files and images, and runs in your browser: nothing is uploaded.