Base64 Encoder and Decoder: text, files, URL-safe Base64 and data URIs

Input
Direction
Output

About Base64 Encoder/Decoder

This tool converts text or files to Base64 and back. Text is handled as UTF-8, so emoji and non-Latin scripts survive the round trip. You can switch to the URL-safe alphabet used in JWTs and web APIs, and choose whether to keep the = padding.

In file mode you can turn any file up to 25 MB into plain Base64 or a data URI. In decode mode you can paste Base64 or a data URI and read it as text, or download the bytes as a file.

Invalid input is explained, not ignored: you get the offending character and its position, or a note that the length cannot be valid. Everything runs in your browser and nothing is uploaded.

How to use it

  1. Choose Text or File.
  2. Pick Encode or Decode for text, or Base64 or Data URI for a file.
  3. Type, paste or drop your input. The result appears at once.
  4. Press Copy, or Download to save the text or the decoded file.

Frequently asked questions

Does it handle emoji and accented letters?

Yes. Text is converted to UTF-8 bytes before encoding and decoded as UTF-8 afterwards. The browser's plain btoa() fails on any character outside Latin-1, which is why many online tools break on non-English text.

What is URL-safe Base64?

Standard Base64 uses + and /, which have special meanings in URLs. The URL-safe form swaps them for - and _ and usually drops the = padding. It is used in JWTs and many web APIs. Decoding accepts both forms, with or without padding.

How do I turn a file into a data URI?

Choose File, pick the file, then set Output to Data URI. The result starts with data: and the file's type, and you can paste it into an img src, a CSS url() or an href. Files up to 25 MB are supported.

How do I decode Base64 back to a file?

Choose Text, then Decode, and paste the Base64 or a data URI. If the bytes are not text, the page says so and Download file saves them. Common types such as PNG, JPG, GIF, WebP and PDF are recognised and get the right extension.

Why does decoding fail?

The message names the problem and its position: a character outside the Base64 alphabet, padding in the wrong place, mixed standard and URL-safe characters, or a length that cannot be valid. Spaces and line breaks are ignored.

Is Base64 encryption?

No. It is a reversible encoding that makes bytes printable, so anyone can decode it. Do not use it to hide secrets. Nothing you enter here is uploaded or stored.