Base64 Encode and Decode

Encode text to Base64 or decode it back, with URL-safe Base64 and file to data URL, all in your browser.

100% private, runs in browser Free, no sign-up
Encode or decode

Encode a file (data URL)

Turn a small picture or file into a data: URL you can paste into HTML or CSS. The file is read on your device, not uploaded.

Encoded in your browser. Your text and files are never sent or saved.

How to use it

  1. Choose Encode or Decode.
  2. Paste your text or Base64 in the first box. The result appears as you type.
  3. Press "Copy result", or "Swap" to feed the result back in the other way.

How Base64 works

Base64 turns any data into 64 safe characters (Aโ€“Z, aโ€“z, 0โ€“9, + and /) so it can travel through email, web addresses, JSON and other places made for text. Text is first turned into bytes using UTF-8, then every 3 bytes (24 bits) become 4 characters of 6 bits each. If the last group is short, = signs pad it. So Base64 is always about a third bigger than the original.

"Man" bytes 77 97 110 โ†’ bits 010011 010110 000101 101110 โ†’ TWFu "Ma" โ†’ TWE= "M" โ†’ TQ== Size โ‰ˆ 4 ร— (bytes รท 3, rounded up) characters

Worked examples

Hello, world! โ†’ SGVsbG8sIHdvcmxkIQ== Hello, world! ๐Ÿ‘‹ โ†’ SGVsbG8sIHdvcmxkISDwn5GL (the emoji is 4 bytes in UTF-8) URL-safe "??>" โ†’ Pz8- (standard: Pz8+)

Frequently asked questions

Is Base64 encryption?

No. Anyone can decode Base64, so it hides nothing. Never use it to protect passwords or private data.

What's URL-safe Base64?

Standard Base64 uses + and /, which have special meanings in web addresses. URL-safe Base64 (described in RFC 4648) uses - and _ instead and usually drops the = padding, so the result can go straight into a link or file name. Our decoder reads both.

Why does decoding say "it isn't text"?

The Base64 is fine, but the data inside is something else, such as a picture. Pictures are often stored as data URLs starting with data:image/png;base64,.

Keep going

Related tools

All Developer tools

Disclaimer: results are estimates for planning only and are not tax, legal or financial advice. Rules and rates vary by country, state and personal situation. Check with a qualified accountant before making decisions. Read the full disclaimer.

Last updated: