Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 back to text instantly in your browser. Unicode-safe. Nothing is uploaded.

Runs in your browser — nothing uploaded
Plain text
Base64 output
Encoded output appears here
Type text above to encode it to Base64.

Use this free Base64 encoder and decoder to convert text to Base64 or Base64 back to text instantly. It handles full Unicode — emoji, accents, and CJK characters all round-trip correctly — and supports the URL-safe (Base64URL) variant used in JWTs and URL parameters.

Private by design — your data never leaves your device

How to use it

No account, no upload — it all happens on your device.

1
Pick Encode or Decode at the top.
2
Paste your text or Base64 into the left panel — output appears instantly on the right.
3
Toggle URL-safe (Base64URL) if you are working with JWTs or values that go in URLs.
4
Hit Copy to copy the result, or Swap to feed the output back as new input.

How Base64 actually works

Three bytes in, four characters out.

Base64 takes raw bytes in groups of three (24 bits) and rewrites each group as four 6-bit pieces, looked up in a 64-character alphabet (A–Z a–z 0–9 + /). 64 = 2⁶, which is why six bits map cleanly to one character. The output is always 33% larger than the input — three bytes become four ASCII chars.

If the input length isn't a multiple of three, the last group is padded with one or two = characters. That padding is what tells a decoder where the message ends.

Worked examples

Plain text in, Base64 out.

InputBase64URL-safe Base64
AQQ==QQ
ABQUI=QUI
ABCQUJDQUJD
helloaGVsbG8=aGVsbG8
caféY2Fmw6k=Y2Fmw6k
🎉8J+OiQ==8J-OiQ

Notice the URL-safe column drops the padding and swaps any + / / with - / _. Otherwise it's the same encoding.

Where it shows up in real apps

Some places use Base64 you might not have noticed.

  • Data URIs for inline images and fonts: data:image/png;base64,iVBORw0KG....
  • HTTP Basic Auth: Authorization: Basic dXNlcjpwYXNz is the Base64 of user:pass.
  • JWT: each of the three dot-separated parts is Base64URL-encoded JSON.
  • Email (MIME) attachments are wrapped in Base64 to survive plain-text transports.
  • SSH keys: ssh-rsa AAAAB3... — the second field is Base64 of the binary key.
  • API payloads: when JSON has to carry binary blobs (images, PDFs), they're usually Base64.

Common confusions

  • Base64 is not encryption.It is encoding — anyone who has the string can decode it. Never use it to "hide" a secret.
  • It doesn't compress. The output is always ~33% larger than the input. If you need smaller, use gzip before encoding.
  • Whitespace is sometimes legal. MIME allows line wraps inside Base64 — most decoders ignore newlines and spaces. This decoder strips them automatically.
  • Older encoders break on Unicode. The JavaScript built-in btoa() throws on non-Latin1 characters; this tool wraps it with a TextEncoder so emoji and CJK work correctly.

Frequently asked

What is Base64 used for?
Base64 turns binary data — or any text — into a safe ASCII string. It is used to embed images in HTML or CSS as data URIs, to carry binary payloads inside JSON or XML, in email attachments (MIME), and in tokens like JWTs.
Does this tool handle emoji and non-English characters?
Yes. The encoder uses UTF-8, so emoji (🎉), accents (café), and any Unicode text round-trip correctly. Many older encoders silently break on non-ASCII input.
What is the URL-safe option?
Standard Base64 uses '+' and '/' which conflict with URL syntax. URL-safe Base64 (Base64URL) replaces them with '-' and '_' and strips padding '=' characters. JWTs, for example, use this variant.

Related tools

JSON Formatter & BeautifierFormat, beautify, and validate JSON instantly in your browser. Your data never leaves your device.JWT Decoder & VerifierDecode and verify JSON Web Tokens (JWT) in your browser. HS256, RS256, ES256 supported. Tokens and keys never leave your device.URL Encoder & DecoderEncode and decode URLs and query parameters in your browser. Handles full URLs and individual components. Always private.