Base64 Encoder/Decoder
Encode and decode Base64 for both text and files, with a live two-way text converter, file-to-data-URL encoding with an image preview, and Base64-to-file downloads. Standard and URL-safe alphabets both supported.
Nothing leaves the browser. Text and files are encoded and decoded entirely on this device — there is no upload, no network request, and nothing is saved.
Base64 turns arbitrary bytes into text made only of letters, digits, +, /, and = padding — the standard way to embed binary data (images, tokens, small files) somewhere that only accepts plain text, like a JSON field, a URL, or an email attachment header. It is not encryption: anyone can decode it instantly, so it protects nothing on its own.
This tool handles both text and files, in both directions. In Text mode, typing in either box live-updates the other, using proper UTF-8 byte encoding — not the common atob()/btoa() mistake of mangling anything outside plain ASCII. In File mode, drop in a file to see its Base64 and ready-to-use data: URL (with a live image preview when applicable), or paste a Base64 string or data URL to decode it back into a downloadable file.
A URL-safe mode is available for contexts like JWTs and URL query parameters, where the standard alphabet's +, /, and = characters would need extra escaping.
How to use this tool
- 1In Text mode, type in either the plain text or Base64 box — the other updates immediately.
- 2Switch to File mode to encode a file: drag it in (or click to browse) to get its Base64 string and data URL, with an image preview when the file is a picture.
- 3To go the other way in File mode, paste a Base64 string or a full data:...;base64,... URL, give it a filename, and download it as a real file.
- 4Toggle URL-safe mode if you need the -/_ alphabet with no padding, e.g. for embedding in a URL or a JWT-style token.
Base64 alphabet
| Value | Standard | URL-safe |
|---|---|---|
| 62 | + | - |
| 63 | / | _ |
| Padding | = (pads to a multiple of 4 characters) | none |
| Size overhead | ~33% larger than the original bytes | ~33% larger than the original bytes |
Frequently asked questions
Is Base64 encryption or a way to hide data?+
No. Base64 is a reversible encoding, not encryption — it has no secret key, and anyone can decode it instantly with a single function call or this exact tool. Never use it to protect passwords, tokens, or anything sensitive; use real encryption or, for storing passwords, a hashing algorithm like bcrypt.
Why does pasting Base64 into Text mode sometimes show an error instead of my file's content?+
Text mode decodes bytes as UTF-8 and expects the result to be valid text. If the Base64 actually represents a binary file (an image, a zip, etc.), the decoded bytes usually aren't valid UTF-8, so the tool reports that instead of showing corrupted-looking text. Use File mode's decode side instead — it turns the same Base64 into a real downloadable file regardless of its content.
Why is my Base64 output so much longer than the original text or file?+
Base64 encodes every 3 bytes of input as 4 output characters, so encoded data is always about 33% larger than the original. This is an inherent property of the encoding, not a bug — it's the cost of representing arbitrary bytes using only 64 printable characters.
What's the difference between standard and URL-safe Base64?+
They use the same encoding, except standard Base64's 62nd and 63rd alphabet characters (+ and /) are replaced with - and _, and the = padding is dropped entirely. This matters because + and / (and to a lesser extent =) have special meaning in URLs and query strings, so standard Base64 needs additional percent-encoding to survive there — URL-safe Base64 doesn't. JWTs use URL-safe Base64 for exactly this reason.
Can I decode a data: URL directly, without stripping the data:...;base64, part myself?+
Yes — File mode's decode side recognizes a full data URL and extracts both the MIME type and the Base64 payload automatically, so you can paste the whole thing exactly as copied.