Base64 encode and decode
Text or files, both directions, in your browser.
How to encode and decode base64
Pick a mode
Encode turns text into base64, Decode turns base64 back into text, and File encodes any file you drop in. Paste into the left pane, press Open to load a text file, or press Sample to see an example.
Set the options
Tick URL-safe to use - and _ with no = padding, the form used in JWTs and query strings. In File mode, tick Data URI to get a data: string ready for an img src or a CSS url().
Copy or download
The result appears on the right as you type. Press Copy, or Ctrl+C (Cmd+C on Mac) with nothing selected, to copy all of it. In Decode mode, As file saves the decoded bytes when the payload is not text.
Good to know
- Decode accepts the standard and URL-safe alphabets, with or without padding, and ignores spaces and line breaks. Base64 wrapped at 76 columns in an email works as it is.
- Text is encoded as UTF-8, so Tamil, emoji and other non-Latin text round-trips correctly. If a decoded payload is not UTF-8 text, a note under the result tells you.
- Files up to 50 MB can be encoded. Base64 is about a third larger than the original, so a 30 MB file gives roughly 40 MB of text.
- Only the first 1 MB of a large result is shown on screen. Copy and the size shown in the status line use the full result.
- Paste base64 while in Encode mode and the tool notices and offers to switch to Decode.
- Nothing is uploaded. Encoding, decoding and file reading all happen in your browser, so it works offline too.
Questions people ask
What is base64 used for?
It writes binary data with 64 printable characters so it can travel through text-only channels such as JSON, email and HTML. It is an encoding, not encryption: anyone can decode it, so it hides nothing.
What does URL-safe mean?
Standard base64 uses + and /, which have their own meaning in URLs. The URL-safe variant swaps them for - and _ and drops the trailing = padding. JWTs and many APIs use this form.
Why does the decoded text show odd characters?
The bytes are not UTF-8 text, for example an image, a PDF or a compressed file. Use As file to download the decoded bytes instead of reading them as text.
How do I make a data URI?
Switch to File mode, pick the file and tick Data URI. The result starts with data:<type>;base64, and can go straight into an img src, a CSS url() or a download link.
Is my text or file uploaded?
No. Encoding, decoding and file reading all run in your browser. Nothing is sent to a server.