Free tool
Base64 Decoder and Encoder for Text, Images and Files
Paste Base64 and get readable text or a downloadable file back. Or go the other way: type text, or drop a picture, a font or a PDF, and get Base64, a data URL, or ready-made HTML and CSS.
First bytes, in hex
Decoding accepts standard and URL-safe Base64, with or without = and line breaks, and data URLs.
Everything is converted in your browser, so keys, tokens and files are not uploaded or saved. Your option choices stay on this device and nothing else does.
Two jobs, two tabs
The tool has a Text and Base64 tab and a File or image to Base64 tab. On the first, choose Decode or Encode, paste into the Base64 or Text box and the other one fills in. Swap exchanges the two sides, and Download as .txt saves the result.
On the second tab, drop any file, or click to choose it, up to 50 MB. You then get the Base64 string, a data URL, and snippets as HTML or CSS with a Copy button for each.
What the decoder accepts
Decoding accepts standard and URL-safe Base64, with or without the equals signs at the end, with line breaks in it, and with a data URL prefix. If a character does not belong, the message names the exact position and character, such as a stray quote mark, so you can delete it and try again.
If the result is a file instead of text, the tool recognises it from the first bytes. Pictures, PDFs, Office files, fonts, audio, video and archives are identified. It shows a preview where the browser can draw it, gives the first bytes in hex, and offers Download the file with the right extension.
Character sets, and why they matter
| Setting | Use it when |
|---|---|
| UTF-8 | The text is in any language, or contains emoji |
| UTF-16 LE | You work with PowerShell's encoded command |
| UTF-16 BE | The source uses the other byte order |
| Windows-1252 and ISO-8859-1 or 15 | An older Western system produced the data |
| Windows-1250, Windows-1251, KOI8-R | Central European and Cyrillic sources |
| Shift JIS, GBK, EUC-KR | Japanese, Chinese or Korean, for decoding only |
The default setting treats a result as text when it is valid UTF-8, and as a file when it is not. Choose UTF-8, always as text if you want to force a text view.
Options when you encode
- URL-safe swaps the plus and slash for a hyphen and an underscore, and drops the equals signs, so the result can sit in a web address.
- Lines of 76 characters wraps the output the way email systems expect.
- Each line on its own encodes every line of a list separately.
For a picture, the HTML and CSS snippets give you the data URL already placed in an image tag or a background rule.
Everyday uses worth knowing
- Reading the encoded body of an email header or a configuration value.
- Turning a small icon into a data URL to place in a style rule.
- Checking what an API returned when a field looks like a long string of letters.
- Making a URL-safe string for a token or a link.
In each case, look at the hex of the first bytes if the output looks like nonsense. Many file types start with a recognisable pattern, and the tool uses the same idea to name them.
A caution about what Base64 is
Base64 is a way of writing bytes as text. It hides nothing, and anyone can reverse it, which is how this page works. Do not treat an encoded password or key as protected.
A Base64 copy of a file is also longer than the file, because every three bytes become four characters. Putting a large picture inline in a style sheet can slow a page, a topic we cover in our guide to website speed for small sites.
Frequently asked questions
What is Base64 used for?
It writes binary data as plain text so that it can sit in places that only take text, such as an email, a JSON file or a web address.
Why does decoding fail with a character error?
The text contains a character Base64 never uses, such as a quote mark. The message gives its position, so remove it and decode again.
Can I decode an image or a PDF?
Yes. If the Base64 holds a file, the tool identifies the type, previews it where possible and lets you download it.
What is URL-safe Base64?
It is a variant that uses a hyphen and an underscore in place of the plus and slash, so it is safe inside a link.
Is Base64 a form of encryption?
No. Anyone can decode it, so never use it to protect a secret.
Is there a size limit for files?
The file tab accepts files up to 50 MB, and the file stays on your computer.
More free tools
- JWT decoder: Decode a JSON Web Token, read its claims and expiry, and check the signature with a key.
- URL encoder and decoder: Percent-encode or decode a URL or a query value, with options for strict encoding and plus signs.
- Image to Base64: Encode pictures as Base64 data URLs, CSS backgrounds, img tags, Markdown or JSON.
- JSON formatter: Format, minify, validate and repair JSON, browse it as a tree, or convert it to YAML or CSV.
- UUID generator: Make v4, v7 or nil UUIDs in bulk and check whether a UUID is valid.