viewer.csslab.dev

Base64 Encoder / Decoder

Encode text to Base64 or decode it back. Handles UTF-8, emoji, and URL-safe variants.

What is Base64?

Base64 is an encoding that represents binary data using 64 printable ASCII characters, so that bytes can travel through channels built for text — email bodies, JSON fields, URLs, HTTP headers, and data URIs. This tool converts text to Base64 and back, in either the standard alphabet or the URL-safe one.

It is not encryption. Anyone can decode a Base64 string, so it hides nothing; it only makes arbitrary bytes safe to carry as text. Encoding also grows the payload by roughly a third, which is why it is used for transport rather than storage.

Base encoding of data is used in many situations to store or transfer data in environments that, perhaps for legacy reasons, are restricted to US-ASCII data.
RFC 4648 §1

Features

UTF-8 correct
Text is converted to UTF-8 bytes before encoding, so Korean, accents, and emoji round-trip intact. The browser's own btoa() fails outright on anything outside Latin-1 — a common source of broken output in other tools.
URL-safe alphabet
The URL-safe mode replaces + and / with - and _ and drops the padding, matching RFC 4648 §5 — the form used by JWTs, JSON Web Keys, and query parameters.
Tolerant decoding
Decoding accepts both alphabets, ignores line breaks and whitespace pasted along with the value, and restores missing padding.
Real errors, not silent damage
If the input is not valid Base64, or the decoded bytes are not valid UTF-8, you get an error instead of a plausible-looking string full of replacement characters.

How to use

  1. 1

    Pick a direction

    Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.

  2. 2

    Paste your value

    Paste or type into the input pane. The result updates as you type.

  3. 3

    Use URL-safe when it belongs in a URL

    If the value will be used in a query string, path, or JWT, choose the URL-safe encode mode so + and / do not need further escaping.

  4. 4

    Copy the result

    Copy the output to your clipboard with one click.

Frequently asked questions

Is Base64 encryption?

No. Base64 is an encoding, not a cipher — it uses no key and anyone can reverse it. It makes binary data safe to carry as text; it does not protect it. Never use it to hide passwords, tokens, or personal data.

Why does my Base64 string fail to decode?

The usual causes are characters outside the Base64 alphabet (often a truncated copy, or a URL-safe value being decoded as standard), a length that is not a multiple of four after padding, or bytes that are not valid UTF-8 text — a Base64-encoded image will decode to bytes but not to readable text.

What is URL-safe Base64?

Standard Base64 uses + and /, which have meaning inside URLs and must be percent-escaped. The URL-safe variant defined in RFC 4648 §5 uses - and _ instead and usually drops the = padding. JWTs use this variant for every segment.

Does Base64 work with Korean text and emoji?

Yes, as long as the text is converted to UTF-8 bytes first — which this tool does. Encoders built directly on the browser's btoa() throw an error on any character above U+00FF, which is why some online tools appear to fail on non-English text.

How much larger does Base64 make my data?

About 33% larger: every three bytes become four characters, plus padding. That overhead is why Base64 is used for transport — inside JSON, email, or a data URI — rather than for storing large files.

Is my data sent to a server?

No. Encoding and decoding happen in JavaScript on your own device. The page has no backend that receives input, so you can safely decode tokens and internal values.

If you hit this

Specifications this follows

Related tools