🔒 No uploads · Processed in your browser 中文

Base64 Encode / Decode

Convert text to and from Base64 (with proper UTF-8 for accents, CJK and emoji), turn a file or image into Base64 or a Data URI, or decode Base64 back into a file. All done locally.

File to Base64: click to choose or drag a file here Images, PDFs, fonts — any file works

Note: Base64 is an encoding, not encryption — anyone can decode it, so never use it to "hide" passwords or other secrets.

How to use

  1. Encode text: type in the left box and click "Encode →". Accented letters, CJK characters and emoji are converted to UTF-8 bytes first, which matches what most programming languages produce.
  2. Decode text: paste Base64 on the left and click "Decode →" to get the original text. If the content is actually an image or other binary data, click "Decode to file" to save it.
  3. File to Base64: choose or drag any file into the box below and its Base64 appears on the right. By default it comes with a data: prefix (a Data URI) that you can use straight in HTML or CSS; untick the option for plain Base64.
  4. Tick "URL-safe" for values that go into URLs or JWTs. "⇄ Swap" moves the result back to the input so you can keep working.

When it's useful

Finding out what's inside a JWT, an API signature or a Base64 section of an email's source. Debugging an HTTP Basic authentication header. Turning a small icon or font into a Data URI to embed in a web page or email template and save a request. Preparing a test payload for an API that expects files or images as Base64 strings. Turning a Base64 image returned by an API back into a file you can open.

Tips

What is Base64?

Base64 is a way of writing any binary data using only 64 safe characters: A–Z, a–z, 0–9, plus and slash, with equals signs as padding at the end. Every three bytes of input become four characters of output. That makes it possible to carry images, keys or arbitrary bytes through systems built for plain text, such as JSON, email, HTML attributes and HTTP headers. The URL-safe variant swaps plus and slash for minus and underscore so the result can sit in a web address without extra escaping.

Privacy

Encoding and decoding happen in your browser; the text you type and the files you choose are never uploaded. Keep in mind that Base64 is just another way of writing data, not encryption — anyone can reverse it. Sharing a Base64 string that contains a password or token is the same as sharing the secret itself.

FAQ

Q: Is anything uploaded?
A: No. All conversion is done locally, and the page has no step that sends your data to a server.

Q: Why does my decoded text look garbled?
A: Usually because it was encoded from a character set other than UTF-8 (such as Windows-1252 or GBK). This tool uses UTF-8, so text from another encoding won't decode cleanly.

Q: What's different about URL-safe Base64?
A: It replaces + with - and / with _, and drops the trailing = padding, so it can go into URL parameters without escaping. Both forms are accepted when decoding.

Q: Can Base64 be used for encryption?
A: No. It's an encoding with no key, so anyone can decode it. Use real encryption for anything secret.

Q: Is there a file-size limit?
A: There's no hard limit, but above 20 MB the output becomes extremely long and the browser may slow down; the tool warns you when that happens.

Q: It says "Not valid Base64" — what's wrong?
A: Check for stray punctuation, a truncated string or a piece missing from what you copied. Valid characters are letters, digits, + / - _ and = at the end.

Ad space (shown after AdSense approval)