AnyFormat

00 Utility

Base64 Encode

UTF-8 correct, URL-safe variant, optional line wrapping.

01Input
02Output
03Options 3

Uses - and _ instead of + and /, so the result is safe in a URL or filename.

0 for one long line. 76 is the MIME convention for email headers; 64 is the PEM convention for certificates.

  • No upload The conversion runs in this tab. Your file never travels — not to us, and not to the advertising.
  • No sign-up, no email, no daily cap There is no account system to sign up to.
  • No size limit we invented Only your device's memory — about ~2 GB on a desktop browser, ~400 MB on a phone.
  • Turn your Wi-Fi off and convert anyway The conversion needs nothing but this page. Ads will not load without a connection; your file will still convert. That is the whole claim, and it takes five seconds to check.

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

Base64 encodes bytes, not characters. To encode text you must first choose an encoding to turn characters into bytes, and that choice is UTF-8 here. The browser's built-in 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

Standard Base64 uses + 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 in email headers is wrapped at 76 characters and in PEM certificates at 64, both because of ancient line-length limits that are still enforced. Set the width if you are producing either; leave it at 0 for anything modern, where an embedded newline is more likely to break the consumer than a long line is.

Base64 is not encryption

It is worth being blunt about this because it is a recurring source of real security incidents: Base64 is an encoding, not a cipher. Anyone can reverse it instantly — that is the entire point of it being reversible without a key. Do not use it to hide credentials, and treat any Base64 blob you find in a config file as plaintext.

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.