Base64 Encoder & Decoder
Base64 encode text or decode it back, UTF-8 clean, so emoji and accented letters survive the round trip. Files go in too, with an optional data: URI wrapper.
Drag & drop your file here, or
Result
The result appears here.
With its size beside it.
Converted
Not base64
Direction
File
What came back
How to use
- Choose the Direction. Text → Base64 encodes what you type; Base64 → Text decodes what you paste.
- Type or paste into the well labelled Text or Base64. The Result well and the report under it follow as you type.
- Encoding a file instead? Drop it on the file picker above the controls; it becomes the source, and typing in the text well lets it go again. Tick Data URI for the data:image/png;base64,… form.
- Copy output takes the text; Download saves the encoded text, or, decoding, the bytes under a name that says what they are, such as decoded.png.
About this tool
Choose Text → Base64 and type, and the encoded form follows in the second well; choose Base64 → Text and paste, and the readable text comes back as you go. Encoding goes through TextEncoder and decoding through a strict TextDecoder, which makes the round trip UTF-8 clean: emoji, accented letters, Devanagari, Japanese all come back exactly as they went in. A bare btoa() call in the console is where that falls apart, and it is usually the reason someone ends up here.
Base64 is the wrapper that lets binary ride inside a format which only accepts text. Data URIs, JSON string fields, mail attachments, the header and payload halves of a JWT. It costs you size: three bytes of input become four ASCII characters, so the encoded form runs about a third longer, and the report beside the wells says by how much. Decoding reads base64url as readily as the standard alphabet, sets a data: prefix aside, and when the bytes turn out not to be text it says what they are and offers them as a file rather than printing them as garbage.
Rough edges
- Base64 is not a lock. Whatever you encode is one paste away from being read, so it protects nothing at all.
- The whole value is held in the tab as a single string. A multi-megabyte file will make the page work for it, and this is a debugging scratchpad rather than a batch pipeline.
- A paste is read in one alphabet. Standard base64 and base64url mixed in one string are refused at the first character of the second alphabet rather than guessed at.
Frequently asked questions
Can it decode a JWT segment?
Yes. JWT segments are base64url, with - and _ where standard Base64 carries + and /, and usually no padding. The page reads the alphabet from the paste, swaps those two characters back and restores the padding, then says what it did. The JWT decoder tool splits all three segments apart and checks the signature as well.
How much bigger does Base64 make a file?
About a third. Every three bytes turn into four ASCII characters, so a 900 KB image comes out near 1.2 MB, plus a few more bytes once the data: prefix is on the front. That overhead is the reason inlining large images as data URIs tends to be a poor trade.
How do I get an image as a data URI for CSS?
Tick Data URI, then drop the image on the file picker. What comes back is data:image/png;base64,… built from the file's own MIME type, ready to paste into a background-image rule or an img src. Files the browser can't identify fall back to application/octet-stream. Image to Base64 does the same job with a preview beside it.
Why does a decode say the bytes are not text?
Because printing them as text would lose them. Bytes that are not valid UTF-8, or that carry control bytes no text uses, would come back full of replacement characters, and encoding that text again would not give the same base64. The page names the file type when it recognises one and offers Download the file instead.
Missing something in Base64 Encoder & Decoder? Suggest a feature →
Tell someone who needs this.