Base64 Encode / Decode

URI Component: Use when putting Base64 in a URL. Encode wraps Base64 with encodeURIComponent (+ / = → %XX) for URLs; Decode does decodeURIComponent first, then Base64.

About this tool

Convert text to Base64 and back as you type. Encoding works on UTF-8 bytes; decoding produces UTF-8 text, so binary payloads that are not valid UTF-8 will not round-trip exactly.

How to use

  1. Choose Encode or Decode.
  2. Optionally enable URI Component.
  3. Paste into Input; Output updates live.
  4. Use Copy Output when ready.

Three different “URL-safe” encodings

These are easy to confuse, so it is worth separating them:

  • Standard Base64 (RFC 4648 §4) uses A–Z a–z 0–9 + / and pads with =. The + and / characters are not safe in a URL.
  • Base64URL (RFC 4648 §5) replaces + with - and / with _, and usually drops the padding. JWTs and many APIs use this form.
  • URI Component, the checkbox here, is neither of those: it percent-encodes the standard Base64 string with encodeURIComponent, so + becomes %2B, / becomes %2F and = becomes %3D.

Decode accepts standard Base64 and Base64URL, with or without padding, so a JWT payload can be pasted directly. Encode always produces standard Base64, optionally percent-encoded.

Example

Text:            hello
Standard:        aGVsbG8=
Base64URL:       aGVsbG8
URI Component:   aGVsbG8%3D

Bytes FB FF ->   +/8=      (Base64URL: -_8)

Limits

  • This page is text-oriented. For arbitrary binary data, use a tool that reads a file rather than a text field.
  • Whitespace at the start and end of the input is trimmed; whitespace in the middle is not removed and will fail to decode.
  • Base64 is an encoding, not encryption. Anyone can reverse it, so it hides nothing.

FAQ

Can I decode a JWT payload?

Yes. Paste the middle segment on its own; the - and _ characters and the missing padding are handled.

Why does Decode fail?

The input is not valid Base64, or it is percent-encoded while URI Component is off. Check that the checkbox matches the string you pasted.

Does this handle binary files?

No. The page converts text, so non-UTF-8 bytes come back as replacement characters.

Further reading

Base64 is an encoding, not encryption explains what Base64 does, why Basic auth is not protected by it, and what to reach for when you need confidentiality.