Encodes text to Base64. The encoding is UTF-8 correct, which is worth stating because the obvious browser one-liner is not: btoa() throws on any character above U+00FF, so half the Base64 tools on the web silently fail on an em dash.
Unicode, and why so many tools get it wrong
btoa() skips this step and treats each character as a single byte, so it throws on anything outside Latin-1 — an em dash, a curly quote, an accented name, any emoji.
Tools built on btoa() either crash or, worse, mangle the text quietly by stripping the high bytes. Round-trip an em dash through this tool and you get an em dash back.
When to use the URL-safe alphabet
+ and /, both of which mean something in a URL — + is a space in a query string and / is a path separator. The URL-safe variant (RFC 4648 §5) swaps them for - and _, which are inert everywhere. JWTs use it, and so does anything that puts a token in a path segment or a filename.
Padding is usually dropped along with it, since = also needs escaping in a URL. The decoder here accepts either.
Line wrapping
Base64 is not encryption
Other names for this
Also searched as “base64 encoder”, “text to base64”, “encode base64 online”.
Questions
- Why is the output about a third larger than the input?
- Base64 represents three bytes with four characters, so the output is always 4/3 the size, plus padding. That overhead is the price of being safe to put in text-only channels.
- Does it handle emoji and accented characters?
- Yes. The text is encoded as UTF-8 first, so every Unicode character round-trips exactly.
- How do I encode a file rather than text?
- Use Image to Base64 for images, which produces a ready-to-use data URI.
- Does my text leave the browser?
- No. Everything runs as JavaScript in this tab — there is no server involved and no request is made. Open the Network panel and watch, or turn your Wi-Fi off and keep using the tool.