Base64 Encode / Decode

Encode any text to Base64 or decode a Base64 string back to plain text.

Related Tools

0 comments

How it works

For encoding, the input is first converted to UTF-8 bytes via TextEncoder, then groups of three bytes are mapped to four ASCII characters from the Base64 alphabet (A–Z, a–z, 0–9, + and /). For decoding, the inverse mapping is applied and the resulting bytes are decoded back from UTF-8 with TextDecoder. The naive btoa()/atob() pair fails on non-Latin-1 input; this tool routes through TextEncoder/TextDecoder to handle every Unicode character correctly, including emoji.

Common use cases

  • Embedding a small image or font in a CSS data URL during prototyping.
  • Inspecting the payload section of a JWT (which is Base64-URL encoded).
  • Pasting binary-ish content through systems that only accept ASCII (email, env vars).

Frequently asked questions

Does it handle emoji and non-ASCII text?

Yes. The tool encodes to UTF-8 first, so any Unicode character round-trips correctly.

What about Base64-URL?

Standard Base64 is produced. To get URL-safe Base64, replace "+" with "-", "/" with "_" and strip padding "=" characters.

Why does my decode fail?

Most likely the input contains whitespace, line breaks or invalid characters. Strip those and ensure length is a multiple of 4 (pad with "=" if needed).

Is the input uploaded?

No. Encoding and decoding happen entirely in your browser.