Modern Niche World MNW

Base64 Encoder and Decoder

Turn text or a file into Base64, or Base64 back into text or a file. Emoji and accents come through intact, and a bad character is pinpointed.

What to do

Encoded as UTF-8. Up to 10,000,000 characters.

Options

Everything runs on your device: what you type, paste or choose never leaves it, and nothing is saved.

Base64 in both directions, done carefully

Base64 writes any bytes with 64 safe characters (A to Z, a to z, 0 to 9, + and /), so binary data can travel through systems built for text: JSON, XML, email, HTML and URLs. You meet it in API keys, email attachments, data URLs for small images and the parts of a JSON Web Token. This tool encodes and decodes it exactly, and says precisely what’s wrong when it can’t.

How to use it

  1. Pick what to do: text to Base64, Base64 to text, a file to Base64, or Base64 back to a file.
  2. Type or paste into the box, or choose a file up to 10 MB. The result appears as you type.
  3. When encoding, turn on URL-safe, padding or line breaks if the place you’re pasting into needs them.
  4. Copy the result, or download it. For Base64 to a file, check the suggested name, then press Download file.

The options

  • URL-safe uses - and _ instead of + and /, for links, file names and tokens.
  • Padding adds = signs so the length is a multiple of 4. Some systems need it; JSON Web Tokens leave it out.
  • Line breaks every 76 characters follow the email (MIME) format. Leave this off for JSON, URLs and code.

When decoding fails

The decoder skips spaces and line breaks and accepts missing padding. Anything else that isn’t Base64 is reported with its character number, line and column, and Select the bad character highlights it in the box. Common culprits: an invisible zero-width space picked up while copying, a % left by URL encoding, or the dot between the parts of a token.

Good to know

  • Base64 isn’t encryption. Anyone can decode it, so never use it to hide a password.
  • Text is encoded as UTF-8, the encoding the web uses, so emoji and accents survive the round trip. Decoded bytes that aren’t text are offered as a file instead, with a guess at the file type.
  • A pasted data URL works too: the decoder reads its type and uses it to name the file you download.
  • Big inputs are fine: up to 10 MB of data. The boxes show the first million characters; Copy and Download always use all of it.
  • A data URL makes an image about a third bigger. Shrink it first with the Image Compressor; for site icons, the Favicon Generator makes proper files.
  • Everything runs on your device: nothing is uploaded, sent or saved.

Frequently asked questions

Is Base64 a way to hide or protect data?
No. Base64 is an encoding, not encryption: anyone can decode it in a second, with this page or any other. It exists to carry bytes through places that only accept text, such as JSON, email or a URL. Never treat a Base64 string as a secret.
Why is my Base64 longer than the original?
Base64 writes every 3 bytes as 4 characters, so the result is about a third bigger, plus up to two = signs of padding. Text with accents or emoji grows more, because each of those characters takes 2 to 4 bytes in UTF-8 before it’s encoded.
What’s the difference between standard and URL-safe Base64?
Two characters. Standard Base64 uses + and /, which mean something else in links and file names; the URL-safe form uses - and _ instead, and often leaves out the = padding. JSON Web Tokens use the URL-safe form. The decoder here reads both.
Is what I paste sent anywhere?
No. Encoding and decoding run in this page, on your device. Nothing you type, paste or choose is uploaded or saved, so it’s safe to use with tokens, keys and private files.