Base64 encoder and decoder
Convert text both ways as you type, turn files into Base64 or data URLs, and paste a blob back to save it as a file. Non-ASCII survives intact, and when a blob will not decode you are told which character on which line is wrong.
InputText
OutputBase64
Nothing here yet
The form used inside URLs, filenames and JWTs. Decoding accepts either form automatically.
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
Three bytes are cut into four six-bit numbers, each written as its place in this table. "=" is not data — it pads the length out to a multiple of four.
Related tools
All tools- Word & character countCharacters, words, lines and reading time, counted as you type.
- Full-width / half-width converterConvert Japanese text between full-width and half-width, one character class at a time.
- Line toolsRemove duplicate and blank lines, sort, trim and number a list — in one pass.
- JSON formatter & validatorPretty-print, minify, sort keys — and point at the exact line that broke.
Highlights
- UTF-8 round-trips correctly
- The browser's own btoa only accepts Latin-1 and throws on anything outside it. This encodes to UTF-8 bytes first, so accents, CJK and multi-codepoint emoji come back exactly as they went in.
- Decode errors show the position
- When input will not decode, the line, column and character are shown. Typical causes such as a full-width space or a curly quote substituted by a chat client are easy to spot.
- Paste it as you have it
- Base64 wrapped at 76 columns by a mail transport, and the URL-safe form used by JWTs (-_ with padding stripped), are both accepted as-is.
How to use it
Choose text or file, and a direction
The switch at the top picks text or file; the one beside it picks the direction — text to Base64 and back, or file to Base64 and back.
Put something in
Paste into the left pane, or drop a file on it. The result appears on the right as you go. When encoding, you can also choose the URL-safe alphabet and whether to keep the trailing =.
Take the result
Copy it, or save it as a text file or as the decoded file. The Swap button in the middle moves the result back into the input and turns the direction around, so you can watch it come back unchanged.
Base64, briefly
- Base64 is not encryption
- There is no key and anyone can reverse it instantly, so it offers no protection. Encoding a password or an API key in Base64 does not hide it. Its job is carrying binary data through channels that only accept text.
- Why it grows by about a third
- Three bytes (24 bits) become four six-bit characters, so the output is always 4/3 (about 133%) of the input, plus a byte or two of padding. This is why inlining an image as a data URL adds about a third to the transfer size.
- When you need the URL-safe form
- Standard Base64 uses + and /, which already mean something in a query string or a filename. The URL-safe variant swaps them for - and _. Every part of a JWT is in this form, usually with the trailing = dropped as well.
- What data URLs are good for
- data:image/png;base64,... embeds an image directly in HTML or CSS instead of a separate file. For a tiny icon that saves a request and is worth it; for a large image it inflates the bytes by a third and makes the data uncacheable, which is usually a net loss.
Questions
- Do emoji and non-Latin text survive?
- Yes — everything is encoded as UTF-8, so a round trip is lossless. If the system on the other end assumes a different encoding, that is a separate problem this cannot fix.
- My Base64 has line breaks in it
- Paste it as it is. Newlines, spaces and tabs are ignored while decoding. Most mail transports wrap at 76 columns, so this is normal rather than corruption.
- How large a file can it handle?
- 25 MB. During conversion the original bytes, an intermediate string and the Base64 all exist in memory at once, which is what the ceiling is for. Very long output is kept off the page to keep it responsive, but copying and saving still work on the full data.
- Is anything uploaded?
- No. Everything runs in the page and is gone when you close the tab. Do remember that Base64 is not encryption, so wherever you paste the result, treat the original as readable.
- Can I read a JWT with this?
- Paste the second dot-separated section and you get the payload JSON; the URL-safe alphabet and missing padding are both handled. It does not verify the signature, so the contents can be read but not authenticated.