Base64 encode and decode

Turn text into Base64 and back, including emoji and accented letters. You can also turn a file into a Base64 data URL.

FreeNo sign-upRuns on your device

Loading the tool…

How to use it

  1. Choose Text to Base64 or Base64 to text.
  2. Paste your text or Base64 into the box. The result appears straight away.
  3. Tick URL-safe if the Base64 is going in a web address or a token.
  4. To encode a file, drop it in the file box and copy the data URL or the Base64 alone.

What Base64 is for

Base64 writes any data using only 64 safe characters: A to Z, a to z, 0 to 9, plus and slash. That lets binary data, like an image or a key, travel through systems built for plain text, such as email, JSON and HTML. It is not encryption. Anyone can decode it, so never use it to hide a password.

Base64 makes data about a third bigger, because every 3 bytes become 4 characters. An = sign at the end pads the last group.

UTF-8 and URL-safe Base64

The browser's built-in btoa function fails on emoji and most non-English letters. This tool first turns your text into UTF-8 bytes, the way servers and other languages do, so the result matches what Python, Node.js or the base64 command would give you.

URL-safe Base64 swaps + for - and / for _, and drops the = padding, so the result can go in a web address without being changed. It is used in JWT tokens and many APIs. The decoder accepts both kinds, with or without padding, and ignores line breaks.

Files and data URLs

A data URL puts a whole file inside a link, like data:image/png;base64,... You can paste it straight into an img tag or a CSS background. It's useful for small icons and test files. For large images it is usually slower than a normal file, because the browser can't cache it separately.

If Base64 decodes to something that isn't readable text, like an image, you can download the decoded bytes as a file.

Privacy

Encoding and decoding happen in your browser. Your text and files are never uploaded.

Questions

Is Base64 a kind of encryption?

No. It's an encoding, and anyone can decode it in a second. Use it to move data safely through text systems, not to keep it secret.

Why does my decoded text look like random symbols?

The Base64 probably holds binary data, like an image or a compressed file, not text. The tool will offer it as a file to download instead.

What is the difference between Base64 and Base64URL?

Base64URL uses - and _ instead of + and /, and usually leaves out the = padding, so it is safe in web addresses. Otherwise they are the same.

Why is my Base64 longer than the original?

Base64 turns every 3 bytes into 4 characters, so it is about 33% bigger. That is normal.