Base64 Encoder/Decoder

Encode or decode Base64 with full UTF-8 support. Nothing is uploaded or stored.

Data to encode:

Example: 京

Data to decode:

Example: 5Lqs

Base64 represents any data using only 64 safe characters (A–Z, a–z, 0–9, + and /, with = as padding). Use this tool to encode text to Base64 or decode a Base64 string back to text. It handles UTF-8 properly, so accented letters, non-Latin scripts and emoji survive the round trip, and it runs entirely in your browser.

How to encode or decode Base64

  1. To encode, paste text into Data to encode and click Encode. The Base64 appears in the other box.
  2. To decode, paste a Base64 string into Data to decode and click Decode. The text appears in the first box.
  3. Copy either side with its copy icon.

Examples: hello encodes to aGVsbG8=, and héllo ✓ encodes to aMOpbGxvIOKckw==.

Where Base64 is used

  • HTTP Basic authentication: the Authorization: Basic … header is username:password in Base64, which is why Basic auth must only be used over HTTPS.
  • Data URIs: small images or fonts embedded in HTML or CSS as data:image/png;base64,….
  • Email: attachments and non-ASCII message bodies are Base64-encoded in MIME.
  • Tokens and keys: JWT segments (in the URL-safe variant), PEM certificates, and DKIM public keys in DNS.

Why UTF-8 matters

The browser's built-in btoa() only accepts characters in the Latin-1 range and throws an error on anything else. This tool first converts text to UTF-8 bytes, then encodes those bytes, which is what servers and other languages expect. Decoding does the reverse.

Common problems

  • "Not valid Base64". The input contains characters outside the Base64 alphabet. URL-safe Base64 (used in JWTs) replaces + with - and / with _; swap them back before decoding here.
  • Decoded text looks like garbage (�). The Base64 holds binary data, such as an image or compressed file, rather than text. This tool decodes to text only.
  • Expecting secrecy. Base64 is an encoding, not encryption: anyone can decode it. For a one-way fingerprint use the Hash Generator.

Frequently asked questions

Is Base64 encryption?

No. Base64 is a reversible encoding with no key. Anyone who has the string can decode it, so it gives no protection to passwords or other secrets.

Why does Base64 end with = or ==?

Base64 encodes 3 bytes as 4 characters. When the input length isn't a multiple of 3, the output is padded with one or two = signs to complete the last group.

Why is Base64 larger than the original?

Every 3 bytes become 4 characters, so Base64 output is about 33% larger than the input.

What is the difference between Base64 and URL encoding?

Base64 converts any data into a fixed 64-character alphabet. URL encoding leaves most text readable and only replaces characters that have a special meaning in URLs, such as spaces and &.