Base64 Converter

Encode and decode Base64 text instantly. UTF-8 safe, all in your browser.

0 characters
0 characters
Auto-detects direction: valid Base64 → text, otherwise text → Base64.

About the Base64 Converter

This Base64 converter runs entirely in your browser. Type or paste text on the left, click Encode to get a Base64 string on the right; or paste a Base64 string on the left and click Decode to recover the original text. Nothing is sent to a server, and full Unicode (UTF-8) text is handled correctly — including emoji, Chinese, Japanese, and other non-ASCII characters.

What is Base64?

Base64 is a binary-to-text encoding scheme that converts binary data into a sequence of printable ASCII characters using a 64-character alphabet: A–Z, a–z, 0–9, +, and /, with = used for padding. Every three bytes of input become four Base64 characters, so the output is always a safe, plain-text string that can travel through systems designed for text.

When is Base64 used?

  • Data URLs — embed small images, fonts, or files directly in HTML/CSS/JS as data:image/png;base64,....
  • Email attachments (MIME) — binary files are Base64-encoded so they can be sent over text-only SMTP transport.
  • JWT tokens — JSON Web Tokens encode their header and payload as Base64URL strings.
  • Embedding images in JSON / XML — when a protocol can only carry text, Base64 lets you ship binary blobs inline.
  • Basic Auth headers — HTTP Authorization: Basic <base64(user:pass)>.
  • Source maps & certificates — keys and source content are often stored as Base64.

Why UTF-8 handling matters

The browser's built-in btoa() and atob() functions only work on Latin-1 characters. If you pass Chinese, Japanese, emoji, or any character above code point 255 directly to btoa(), it throws an InvalidCharacterError. This tool works around that limitation with the standard UTF-8 round-trip pattern:

utf8ToBase64(str) = btoa(unescape(encodeURIComponent(str)))
base64ToUtf8(b64) = decodeURIComponent(escape(atob(b64)))

This ensures that "Café" encodes to Q2Fmw6k= and decodes back to "Café" without corruption — exactly what you'd expect from a modern Base64 tool.

How to use

  1. Type or paste your text or Base64 string into the Input field on the left.
  2. Click Encode (text → Base64) or Decode (Base64 → text). The result appears on the right.
  3. Use Swap to move the output back into the input so you can keep working in either direction.
  4. Use Copy output to copy the result to your clipboard, or Clear to reset both fields.
  5. Turn on Live mode to convert automatically as you type — the tool detects the direction.

Frequently asked questions

Is my data uploaded anywhere? No. All encoding and decoding happens locally in your browser via JavaScript. You can use this tool offline once the page is loaded.

Does it support Chinese, Japanese, and emoji? Yes. The tool uses a UTF-8 safe encoding pattern, so any Unicode text is encoded and decoded without corruption.

Why does my decoded text look garbled? You probably tried to decode something that isn't valid Base64, or the original was encoded with a different scheme (such as Base64URL, which uses - and _ instead of + and /). Make sure the input length is a multiple of 4 and contains only valid Base64 characters.

Is there a length limit? The only limit is your browser's available memory. Multi-megabyte strings work fine, but very large inputs may take a moment and slow down the page.

What's the difference between Base64 and Base64URL? Base64URL is a URL-safe variant that replaces + with -, / with _, and often drops the = padding. It's used in JWTs and URL query parameters.