Base64 encode and decode
Convert text or files to Base64 and back, with UTF-8, URL-safe and data URL options.
Runs entirely in your browser
Drop a file to encode it
Up to 25 MB. Or drag it anywhere on this page.
Base64 to file
Files up to 25 MB. Base64 to file accepts input that decodes to up to 25 MB.
How to encode or decode Base64
- For text, type or paste it in the box, pick Encode or Decode, and the result appears as you type.
- Turn on URL-safe Base64 or 76-character line wrapping if the place you are pasting into needs it.
- For a file, switch to File and drop it in to get its Base64 or a data URL. To go the other way, paste Base64, name the file and download it.
What Base64 is for
Base64 represents any sequence of bytes using 64 safe text characters: A-Z, a-z, 0-9, plus and slash. Every 3 bytes become 4 characters, with = padding to fill the last group. That makes binary data safe to place in email, JSON, HTML, URLs and other places that only handle text. It is an encoding, not encryption: anyone can reverse it.
Text is first turned into bytes, and the character encoding matters. This tool uses UTF-8, the standard on the web, so non-English text and symbols survive a round trip. Decoding checks the result is valid UTF-8 and tells you if it is not, which usually means the data was a file rather than text.
File mode reads the file in your browser and encodes it in small slices so the page stays responsive. Going the other way, the tool decodes pasted Base64 into bytes and gives them to you as a download. It looks at the first bytes to suggest a file extension for common formats such as PNG, JPEG, GIF, PDF and ZIP.
Tips
- Working with JSON that contains Base64 values? Tidy it with the JSON formatter.
- Need random identifiers? See the UUID generator.
- Escaping text for a link or query string is a different job: use URL encode and decode. To read a JWT, which is Base64url inside, use the JWT decoder.
Questions
Is my text or file uploaded?
No. Everything is converted in your browser and nothing is sent anywhere or stored.
Does it handle accented letters and emoji?
Yes. Text is converted to UTF-8 bytes before encoding and decoded as UTF-8 afterwards, so characters such as é, ö, ✓ and emoji round-trip correctly. (The browser's built-in btoa would fail on them.)
What is URL-safe Base64?
It swaps the characters + and / for - and _ and drops the trailing = padding, so the result can sit in a URL or file name. When decoding, this tool accepts either alphabet.
Why does decoding say there is an invalid character?
Base64 only uses letters, digits, plus and slash (or minus and underscore), with equals signs at the end. Spaces and line breaks are ignored, but anything else is reported with its position so you can find it.
Does a data URL differ from plain Base64?
A data URL is the Base64 with a prefix like data:image/png;base64,, so a browser can use it directly as an image or file source. Turn on the data URL option in File mode to get that form.
Why is Base64 larger than my file?
Base64 writes every 3 bytes as 4 characters, so the encoded text is about a third bigger than the original. It is a way to carry binary data as text, not a form of encryption or compression.