Base64 Encoder and Decoder

Encode and decode Base64 text and files, including data URIs.

Runs in your browser. Your input is not uploaded.

You can also drop a file here (up to 10 MB). Files are read on your device.

Encoding options

What is Base64?

Base64 is a way of writing any data, including images and other binary files, using only 64 safe text characters:A–Z, a–z, 0–9, + and /. It is used to embed images in HTML and CSS as data URIs, send attachments in email, store binary values in JSON, and in HTTP Basic authentication headers and JSON Web Tokens.

How to use it

  • Encode text: type or paste text and press Encode.
  • Encode a file: choose Encode a file or drop a file onto the input. TickOutput as data URI to get a value you can use directly in an <img src> or CSSurl().
  • Decode: paste Base64 and press Decode. If the result is text, it is shown. If it is a file such as an image or PDF, its type is detected and you can preview or download it.

After the first Encode or Decode, the result updates as you type.

Options

  • URL-safe uses - and _ instead of + and / and drops the padding, as in Base64URL (RFC 4648), JWTs and many web APIs. Decoding accepts both forms automatically.
  • Wrap at 76 characters adds line breaks, as required by MIME email. Decoding ignores line breaks.
  • Output as data URI adds a prefix such as data:image/png;base64,.

Unicode and emoji

Text is converted to UTF-8 bytes before encoding, so accented letters, non-Latin scripts and emoji work correctly. JavaScript’s built-in btoa() fails on these characters, which is a common source of broken Base64. For example, “café” encodes to Y2Fmw6k=.

Limitations

  • Files can be up to 10 MB. Very large Base64 text may make the page slow.
  • Decoded text is read as UTF-8. Text in other encodings, such as Windows-1252, is treated as a binary file.

Frequently asked questions

Is Base64 encryption?

No. Base64 is an encoding, not encryption. It turns binary data into plain text characters so it can travel through systems that only handle text, such as email, JSON or URLs. Anyone can decode it, so never use it to hide passwords or secrets.

Why is Base64 bigger than the original?

Base64 represents every 3 bytes with 4 characters, so encoded data is about 33% larger than the original, plus a little padding. That is why large images are usually better served as normal files than as Base64 data URIs.

Why does my Base64 end in = or ==?

The equals signs are padding. They appear when the input length is not a multiple of 3 bytes, so the output is a multiple of 4 characters. Many systems, including JWTs and URL-safe Base64, leave the padding out. This tool accepts Base64 with or without it.