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.
- 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.
- 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.
- Press Swap to send the output back as input in the other direction, for example to check a round trip.
- 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.