Base64 decode and encode

Base64 decode strings to readable text or a downloadable file, or encode text and files to Base64. UTF-8 and emoji are handled correctly, with an optional URL-safe base64url output.

Processed on this device. Nothing is uploaded.
Loading Base64 Encode / Decode…

How to decode and encode Base64

  1. In the Text tab, paste text or a Base64 string into Input.
  2. Click Encode or Decode; with Live on, the output updates as you type.
  3. Tick URL-safe for base64url output without padding, or use Swap to reverse the direction.
  4. To convert a file, open File → Base64, drop the file, then copy the result or save it as .txt.

What you can do with Base64 Encode / Decode

Full UTF-8 support
Accented letters, non-Latin scripts and emoji encode and decode correctly, unlike the browser's plain btoa function, which fails on them.
URL-safe base64url
Output uses - and _ instead of + and / with no = padding, the variant used in JWTs and URL parameters.
Forgiving decoder
Decodes standard or URL-safe input, ignores whitespace and line breaks, adds missing padding and strips a data: URL prefix.
Decode to file
When decoded data isn't text, such as an image or PDF, download it as a file, using the MIME type from a data URL when present.
File to Base64
Drop any file to get its Base64 string, with an optional data URL prefix ready for HTML or CSS, plus an image preview.

How Base64 encoding works and when base64url is used

Base64 represents binary data using 64 printable ASCII characters: A–Z, a–z, 0–9, + and /, with = as padding. Every 3 bytes become 4 characters, so encoded data is about 33% larger than the original. It's used wherever binary data must travel through text-only channels: email attachments (MIME), data URLs that embed images in HTML and CSS, HTTP Basic authentication headers, JSON payloads and JSON Web Tokens. Base64 is an encoding, not encryption. Anyone can decode it, so never rely on it to hide passwords or secrets.

The URL-safe variant, base64url, defined in RFC 4648, swaps + for - and / for _ so the string can sit in a URL or file name without escaping, and usually drops the = padding. If decoding fails, check for characters outside the Base64 alphabet, a truncated string, or text that was itself URL-encoded (%2B, %2F) and needs URL-decoding first. For images, inlining as Base64 saves an HTTP request but increases size, so it's best reserved for small icons of a few kilobytes.

Frequently asked questions

Is my data sent to a server when I decode Base64?

No. Encoding and decoding happen in your browser with JavaScript. Text, tokens and files you convert never leave your device and aren't stored, which matters because Base64 strings often contain credentials, API payloads or private documents.

Why do I get an invalid Base64 error?

The input contains characters outside the Base64 alphabet, or its length is impossible for Base64 data, often because it was cut off when copied. Whitespace, missing padding and URL-safe characters are fixed automatically, so look for stray symbols like %, quotes or a partial string.

Can I decode Base64 to an image or PDF?

Yes. Paste the Base64 string, or a full data URL, and click Decode. If the result isn't text, a Download decoded file button appears. With a data URL prefix the file gets the right extension; otherwise it saves as .bin and you can rename it.

What's the difference between Base64 and base64url?

They use the same scheme with two different characters. Standard Base64 uses + and / and pads with =, while base64url uses - and _ and usually omits padding so it's safe in URLs and file names. JWTs use base64url, and this decoder accepts both.

Is there a file size limit?

There's no hard limit, but everything is processed in memory. Files up to tens of megabytes work well. Above 50 MB the tool warns that displaying the output may be slow, since the encoded text is about a third larger than the file.