Skip to content

Encode or decode Base64

Encode text to Base64 or decode Base64 back to text, UTF-8 safe, with a URL-safe option.

0 / 2,000,000 characters · Updates as you type.

Settings

Decoding accepts both alphabets automatically.

Runs in your browser. Nothing you type is sent anywhere.

How it works

Base64 turns any bytes into 64 printable ASCII characters so they survive systems that only handle text: email bodies, JSON fields, HTTP headers, data URLs. Every three bytes become four characters, so the encoded form is about 33% larger than the original.

The classic browser functions btoa and atob only work on Latin-1 characters and throw on anything else. This tool encodes the text as UTF-8 first, so Arabic, Chinese, emoji and accented letters round-trip correctly. The URL-safe variant (RFC 4648 section 5) swaps + and / for - and _ and drops the trailing = padding; it is what JWTs, OAuth state parameters and many APIs use. Decoding accepts either alphabet, with or without padding, and ignores whitespace.

How much bigger Base64 makes data

Every 3 bytes become 4 characters, plus padding; MIME email wraps the result with a line break every 76 characters.

  • Data URLs: a 100 KB image embedded as data:image/png;base64,... adds about 133 KB to the HTML or CSS, and it cannot be cached separately.
  • Email: attachments travel as MIME Base64, which is why a 25 MB attachment limit fits only about 18 MB of files.
  • JSON and APIs: binary fields (images, PDFs, keys) are often Base64 strings; use the URL-safe alphabet if the value goes into a URL.
OriginalBase64 (one line)With MIME line breaks
100 bytes136 bytes138 bytes
1.0 KB1.3 KB1.4 KB
10.0 KB13.3 KB13.7 KB
100.0 KB133.3 KB136.8 KB
1.00 MB1.33 MB1.37 MB
5.00 MB6.67 MB6.84 MB

How to use it

  1. Choose the direction: encode text to Base64, or decode Base64 back to text.
  2. Paste your input. The result updates as you type.
  3. For encoding, turn on URL-safe if the value goes into a URL or a JWT.
  4. Copy the output or download it as a text file.

Frequently asked questions

Is Base64 encryption?

No. Anyone can decode it instantly; it hides nothing. Use it only for transport, never to protect secrets.

Why does decoding show strange characters?

The Base64 probably encodes binary data (an image, a compressed file) rather than text, or text in an encoding other than UTF-8. Bytes that are not valid UTF-8 are shown as replacement characters.

Can I decode a data URL?

Paste only the part after the comma (after "base64,"). The prefix "data:image/png;base64," is not Base64 and will be rejected.

What about line breaks every 76 characters?

MIME-style Base64 wraps lines at 76 characters. The decoder ignores all whitespace, so wrapped input works. The encoder produces a single line.