Base64 encoder / decoder

Convert text to Base64 and back. Input is treated as UTF-8, so Chinese, emoji and accents survive the round trip — with an optional URL-safe alphabet.

How to use

  • Put your text on the left and press Encode — the Base64 appears on the right.
  • Put Base64 on the right and press Decode — the original text comes back on the left.
  • With the URL-safe alphabet the output never contains +, / or =, so it can go straight into a URL or a filename.

Why many online Base64 tools mangle non-ASCII text

The browser's btoa() only accepts Latin-1. Feed it Chinese and it either throws or silently produces garbage. The correct order is: encode the string to UTF-8 bytes first, then Base64 those bytes. That is what this tool does, so 你好 becomes 5L2g5aW9 instead of mojibake.

Where you actually need it

  • HTTP Basic auth: Authorization: Basic base64(user:password).
  • Data URLs: data:image/svg+xml;base64,... inlines a small asset and saves a request.
  • JWT payloads: the middle segment of a token is Base64URL-encoded JSON.
  • Moving data through text-only channels: config values, headers, CI variables.

One caution

Base64 is encoding, not encryption. Anyone can reverse it in a second, so it protects nothing. It also inflates payloads by roughly 33%, which makes it a poor fit for large data.

FAQ

Decoding fails — what now?

Check for spaces, line breaks or a truncated string first. URL-safe Base64 also fails until you switch the alphabet, because - and _ are not valid standard characters.

Can it convert image files?

This version works on text. Image to Base64 (or back) is a common request — send it through the contact page and it will be considered.

Does the encoded result get uploaded?

No. Everything is computed in your browser; no request is made.

Other tools