Base64 encode and decode

Paste some text and the result appears instantly: if it is Base64, it gets decoded; if not, it gets encoded. It handles full UTF-8 and works with files too.

If you paste Base64 from a file (image, PDF, ZIP…), we recognize it and you can download it.

Direction
Base64 options
Variant

Options apply when encoding. When decoding, we detect the variant and accept text with or without padding.

Type or paste some text and the result appears instantly.

Step by step

How to use it

  1. Type or paste your text into the input. In “Automatic” mode we detect whether it is Base64 (and decode it) or plain text (and encode it).
  2. If you prefer to decide yourself, choose “Encode” or “Decode”. Open “Base64 options” to use the URL-safe or MIME variant, remove the “=” padding, or add a Data URI prefix.
  3. For a file, switch to “File”, drop it in, and copy or download its Base64.
  4. If you paste the Base64 of a file (an image, a PDF, a ZIP), we recognize its type from its signature, show a preview, and let you download it with the right extension.
  5. If the text has an error, we tell you the line and column where it is, and you can jump straight to that character.
FAQ

Frequently asked questions

Why do btoa() and atob() fail with accented letters, symbols, and emojis?

Because they only accept single-byte (Latin-1) characters. This tool first converts your text to UTF-8 bytes, like any modern system does. For example, “你好” is encoded as 5L2g5aW9 and decodes back to exactly the same text.

What is the difference between standard, URL-safe, and MIME Base64?

The standard variant uses “+” and “/”. The URL-safe variant (RFC 4648) replaces them with “-” and “_” so it can go in a URL or a file name, and it usually omits the “=” padding (that is how JWTs work). MIME splits the output into lines of 76 characters, as in email.

Is Base64 a form of encryption?

No. Base64 is a reversible encoding with no key: anyone can decode it. It is meant to carry binary data as text, not to hide it. If you need to protect data, encrypt it first.

Why is the result about 33% bigger?

Every 3 original bytes become 4 characters, so the size grows by a third (plus a little padding). With MIME, line breaks add a bit more. We show you the size before and after.

Are my text or files uploaded to a server?

No. Everything is processed in your browser with JavaScript, even files up to 50 MB, and you can check it in the Network tab of your developer tools: no requests are sent. Only the variant and padding you choose are saved on your device, never your text or files.

What does “padding” mean, and why does my Base64 fail without “=” signs?

The “=” padding completes the last group of 4 characters. Many systems leave it out (JWTs, URLs). We accept that and let you know we filled it in. It only fails when the length is impossible, for example when one character is left over because the text was cut off.

What is Base64

Base64 represents binary data using only 64 safe characters (letters, numbers, “+” and “/”). It is used to send images inside an email, embed files in HTML or CSS through a Data URI, store keys and certificates as text, and carry data inside JSON.

Examples

  • hello is encoded as aGVsbG8=.
  • 你好 is encoded as 5L2g5aW9 (UTF-8).
  • The bytes FB FF FE are +//+ in standard Base64 and -__- in URL-safe.

When to use each variant

  • Standard: the default choice for JSON, XML, and email.
  • URL-safe: for URL parameters, file names, and tokens such as JWTs.
  • MIME: for email and PEM certificates, with lines of 76 characters.

Updated on September 29, 2026