Base64 Decode & Encode

Base64 decode a string back to readable text, or encode text and files to Base64, with full UTF-8 support so accents, other scripts and emoji survive the round trip. The converter accepts both standard Base64 and the URL-safe Base64URL variant, and tells you exactly which character is wrong when the input is not valid.

Mode
Decoded 19 bytes · standard Base64 alphabet

Runs entirely in your browser. Nothing you paste is uploaded or stored.

How do you decode Base64?

To decode Base64, turn each character back into the 6-bit value it stands for, join the bits and read them as 8-bit bytes, then interpret those bytes as UTF-8 text. Paste the string above and the decoder does this instantly in your browser. Base64URL strings with - and _, line breaks and missing = padding are all accepted.

How to use the Base64 decoder and encoder

Everything runs inside this page, so you can Base64 decode online without the data ever leaving your device.

  1. Decode: paste the Base64 string. The text appears on the right. If the bytes are not text (an image, for instance), you get a hex preview and a download button instead.
  2. Base64 encode: switch to Encode and type text, or open or drop a file to turn it into Base64. Tick Base64URL for a URL-safe result without padding, or Wrap lines for 76-character MIME lines.
  3. Press Swap to send the output back as input in the other direction, for example to check a round trip.
  4. Paste a whole Authorization: Basic … header to decode HTTP basic auth and see the username and password separately.

How Base64 works

Base64 takes three bytes (24 bits) at a time and cuts them into four 6-bit numbers between 0 and 63. Each number picks one character from the alphabet A–Z a–z 0–9 + /. When the input does not divide evenly into threes, the last group is padded with = so the output length is always a multiple of four. Encoding the word “Man”:

Text      M        a        n
Bytes     77       97       110
Bits      01001101 01100001 01101110
6-bit     010011 010110 000101 101110
Values    19     22     5      46
Base64    T      W      F      u        → "TWFu"

Because four characters carry three bytes, Base64 text is about a third longer than the original data. The rules, including padding and the alphabet table, are in RFC 4648, section 4.

Base64 vs. Base64URL

The + and / characters have special meanings in URLs and file names, so RFC 4648, section 5 defines a URL- and filename-safe alphabet that uses - and _ instead. Base64URL usually drops the = padding as well. JSON Web Tokens are three Base64URL strings joined by dots, which you can read in the JWT decoder. This decoder detects which alphabet a string uses and reports an error if the two are mixed.

Base64 to text and UTF-8

Base64 encodes bytes, not letters, so text must first be turned into bytes with a character encoding. This tool always uses UTF-8. That matters in JavaScript, where the built-in btoa() only accepts characters up to U+00FF and throws on anything else:

// Encode text to Base64 (UTF-8 safe)
const bytes = new TextEncoder().encode('Grüße 👋')
const b64 = btoa(String.fromCharCode(...bytes))

// Decode Base64 to string
const text = new TextDecoder().decode(
  Uint8Array.from(atob(b64), (c) => c.charCodeAt(0)),
)

If decoded text shows odd characters such as é instead of é, the original was probably encoded from a different character set, such as Windows-1252, rather than UTF-8.

Base64 is encoding, not security

Base64 has no key and no secret: decoding is a lookup anyone can do. It is designed to move bytes safely through text-only channels, not to protect them. Treat Base64-encoded credentials, API keys or tokens exactly as you would the plain values, and never paste production secrets into websites you do not trust. This page decodes locally and sends nothing, but the safest secret is one that is never copied.

Frequently asked questions

What is Base64?

Base64 is a way of writing any binary data using only 64 safe text characters: A–Z, a–z, 0–9, + and /, with = for padding. It is defined in RFC 4648 and is used wherever bytes have to travel through systems that only handle text, such as email attachments, data URLs, JSON fields and HTTP headers.

What is Base64 encoding?

Base64 encoding is the process of converting bytes into Base64 text: the input is read 3 bytes (24 bits) at a time and split into four 6-bit groups, each written as one of the 64 characters. The output is about 33% larger than the input, and = is added at the end when the input length is not a multiple of 3.

How to decode Base64?

To decode Base64, paste the string into the decoder above and the original text appears instantly; Base64URL and missing padding are handled automatically. On the command line use echo "SGVsbG8=" | base64 --decode, and in JavaScript decode the bytes with Uint8Array.from(atob(s), c => c.charCodeAt(0)) and TextDecoder so UTF-8 text is not garbled.

Is Base64 encryption?

No, Base64 is not encryption: it is a reversible encoding with no key, so anyone can decode it in one step. Never use Base64 to hide passwords or secrets; HTTP Basic authentication, for example, only Base64-encodes the username and password, which is why it must be sent over HTTPS.