How to encode and decode Base64
- Choose whether you are working with text or a file.
- For text: type or paste it in and the Base64 appears as you go. Paste Base64 into the right-hand box instead and it decodes back.
- For a file: drop it in to get a Base64 data URI you can paste straight into CSS or HTML.
Questions people ask
Does Base64 encrypt anything?
No, and this is the most important thing to know about it. Base64 is an encoding, not encryption — anyone can decode it in one step, including with this page. It exists to carry binary data safely through systems that only handle text, such as email or a JSON field. Never use it to hide a password or a key.
Why did another tool mangle my accented characters?
Because the browser’s built-in btoa function only accepts characters up to U+00FF, and many tools feed text straight into it. This one encodes through UTF-8 first, so "café", "日本語" and emoji all round-trip exactly.
What is the URL-safe variant for?
Standard Base64 uses + and /, both of which have special meaning inside a URL and get re-encoded as %2B and %2F. The URL-safe alphabet swaps them for - and _ and drops the trailing = padding, so the result can sit in a query string or a path segment untouched. JSON Web Tokens use it.
Why is my Base64 file bigger than the original?
Base64 represents every 3 bytes as 4 characters, so the output is always about 33% larger, plus a little for line breaks. That overhead is the price of making binary data text-safe. It is why embedding large images as data URIs slows a page down rather than speeding it up.
Is there a size limit on files?
The encoding runs in your browser, so the practical ceiling is memory. Files up to a few megabytes are fine. Beyond roughly 10 MB the resulting string becomes unwieldy to copy and is almost certainly the wrong approach — link to the file instead of embedding it.
Is my data uploaded?
No. Both directions run on your own device.