Encode and decode Base64
Base64 turns any data, text or a file, into plain letters, digits and a few symbols, so it can travel through systems that only accept text: JSON, XML, email, web addresses, HTML and configuration files. Paste text on the left to encode it, or Base64 on the right to decode it; with "Convert as I type" on, the other side updates at once. Files work too: encode a picture or a PDF into Base64 or a data URL, or turn Base64 back into the original file.
Everything runs in your browser. Nothing you paste is uploaded, which matters, because Base64 often hides passwords and API keys.
How to use it
- To encode, type or paste text in the Text box. The Base64 appears on the right.
- To decode, paste Base64 in the right box. The text appears on the left. Spaces and line breaks in the Base64 are ignored.
- For a file, press "Encode a file". With "As a data URL" ticked, you get a string such as data:image/png;base64,… that can go straight into HTML or CSS.
- To get a file back from Base64 or a data URL, paste it on the right and press "Decode to a file".
Things that often go wrong
- Accents and emoji: Base64 encodes bytes, not letters, so text must be turned into bytes first. This tool uses UTF-8, the standard almost everywhere, so "café" and "😀" survive a round trip. Older tools that skip this step break such text.
- URL-safe Base64 replaces + and / with - and _ and usually drops the = padding. It is used in web addresses and in JSON Web Tokens (JWT). Decoding accepts both kinds automatically.
- Not text inside: if Base64 holds a picture or a zip file, decoding it as text shows gibberish. The tool tells you, and you can save it as a file instead.
- Missing padding: Base64 copied without its final = signs still decodes here.
Base64 is not encryption
Anyone can decode Base64 in a second, as this page shows. It hides nothing. Basic authentication headers, many configuration files and tokens are only Base64-encoded, so treat them as if they were plain text. To actually protect text or a file with a password, use Encrypt Text and Files.
Good to know
- Size: Base64 is about a third larger than the original, because every 3 bytes become 4 characters.
- Line breaks every 76 characters are what email attachments (MIME) use. Most other uses want one long line.
- Large files of a few tens of megabytes work, but the text box becomes slow to scroll. The file buttons handle them without showing everything.
How this tool was tested
Before publishing, I ran 29 automated checks on the finished page in Microsoft Edge, which is built on Chromium like Chrome. Last full run: 21 November 2026.
- Standard examples: the test vectors published in RFC 4648 ("f", "fo", "foo" and so on) encode and decode exactly.
- Text: accents and emoji as UTF-8, URL-safe Base64, missing padding, spaces and line breaks in the input, lines of 76 characters for email, and 300 random texts with accents, Chinese and emoji that survived a round trip in all three styles.
- Binary data: 5,000 random bytes gave exactly the same Base64 as the browser's own encoder, and decoded back byte for byte. Invalid characters and impossible lengths are refused.
- Using the tool: encoding and decoding as you type, Base64 that holds a picture recognised and saved as a PNG byte for byte, a data URL keeping its file type, encoding a file as a data URL, and Swap.
What the tests did not cover: Files over 50 MB were not tested. Safari and Firefox were not tested. Something not working? Tell me on the contact page.
FAQ
Can I decode a JWT here?
Yes, one part at a time: paste the middle part (between the two dots) on the right to read the token's contents. The signature cannot be checked here.
What is a data URL?
A whole file written as text, with its type in front, such as data:image/png;base64,iVBOR…. Browsers can show it as an image without a separate file.
Is it safe to paste secrets?
Nothing leaves your browser. Clear the boxes afterwards if others use your computer.