Base64 Encode/Decode

Encode and decode text to/from Base64 with UTF-8 support and URL-safe variant.

URL-safe Base64
0 characters
0 characters
Result will appear here...

Base64 Encode/Decode

The Base64 Encoder/Decoder is a free online tool that converts text to and from Base64 encoding directly in your browser. It supports standard Base64 as well as URL-safe Base64 variant, handling UTF-8 characters correctly.

Real-time conversion updates as you type, with a convenient swap button to exchange input and output. All encoding and decoding is performed locally — no data is sent to any server, making it safe for sensitive data.

How it works

Base64 encoding converts binary data to a text representation using 64 ASCII characters (A-Z, a-z, 0-9, +, /). Each group of 3 bytes is converted to 4 Base64 characters. URL-safe variant replaces + with - and / with _, and removes padding (=).

Use cases

  • Encoding binary data for embedding in JSON, XML, or HTML
  • Decoding Base64-encoded API responses and tokens
  • Converting data URIs for images and files
  • Working with email attachments encoded in Base64 (MIME)
  • Encoding credentials for HTTP Basic Authentication headers

Frequently asked questions

How does Base64 encoding work?

Base64 converts binary data into text using 64 ASCII characters: A-Z, a-z, 0-9, plus (+) and slash (/). Every group of 3 bytes becomes 4 Base64 characters, which is why encoded output is about 33% larger than the original. If the input length is not a multiple of 3, the output is padded with equals signs (=).

Is Base64 a form of encryption?

No. Base64 is an encoding, not encryption — anyone can decode it instantly without a key or password. It only changes how data is represented so it can travel safely through text-based systems. Never rely on Base64 alone to protect passwords or sensitive information.

What is the difference between standard and URL-safe Base64?

Standard Base64 uses + and /, which have special meanings in URLs and file names. The URL-safe variant replaces + with - and / with _, and usually drops the = padding. Use URL-safe Base64 for query strings, JWT tokens, and file names; use the standard variant everywhere else.

Why does my Base64 string fail to decode?

Decoding fails when the string contains characters outside the Base64 alphabet, has incorrect padding, or was truncated. Whitespace and line breaks copied along with the string are a common culprit. Also check whether the string uses the URL-safe alphabet (- and _), which needs to be decoded with the matching variant.

Is it safe to paste sensitive data into this Base64 tool?

Yes. All encoding and decoding happens locally in your browser using JavaScript — nothing is sent to any server. Still, remember that Base64 is trivially reversible, so the output should be treated with the same care as the original data.

Related Calculators