Base64 Encoder & Decoder
Encode a file
Choose any file (up to 10 MB) to get its Base64 text, for example to embed a small image as a data URI.
About this tool
Base64 turns bytes into plain text made of letters, digits, + and /, so binary data can travel through
text-only places such as JSON, email, HTTP headers and HTML. This tool encodes and decodes it, treats text as UTF-8,
and handles the URL-safe variant used by JWTs.
Everything runs in your browser. Your text and files are never sent to a server.
How it works
- Text is converted to UTF-8 bytes first, so non-English characters and emoji encode correctly. The plain
btoa()function in browsers fails on these. - Decoding accepts both the standard and URL-safe alphabets, ignores spaces and line breaks, strips a leading
data:...;base64,prefix, and adds missing=padding for you. - If the decoded bytes are not valid UTF-8 text (an image, for example), the tool says so and offers a download instead of showing garbage. It recognizes PNG, JPEG, GIF, WebP, PDF and ZIP files and gives the download a matching extension; anything else is saved as
.bin. - Files are limited to 10 MB because the result is shown in a text box. Base64 output is about 33% larger than the original.
FAQ
Q. Is Base64 encryption?
A. No. Anyone can decode it, so never use it to protect secrets. It is only an encoding for carrying bytes as text.
Q. What is URL-safe Base64?
A. It replaces + with - and / with _ so the result can sit in a URL or file name without escaping. JWTs use it without = padding.
Q. Why does decoding say "not valid Base64"?
A. Base64 only contains letters, digits, + / = - _ and whitespace. A length that leaves one stray character, or any other symbol, makes it invalid. Check for a copied quote mark or a truncated string.