Base64 Encoder and Decoder

Developer

Encode and decode, standard and URL-safe. Client-side only.

Base64
TWFidWhheSEg4oKxMSwyMzQuNTY=
Bytes in20
Characters out28
Overhead+40%

The classic alphabet. Percent-encode it before putting it in a URL.

18 characters is 20 bytes in UTF-8 — anything outside plain ASCII takes two to four bytes each.

How to use

What it's for

Turn text into Base64, or Base64 back into text. Base64 writes any data using only letters, numbers and a few symbols, so it survives email, web links and settings files.

Before you start

Have the text, or the Base64 string you were given, ready to paste. It is converted in your browser and is never sent anywhere.

  1. Choose the direction

    Press Text → Base64 to turn ordinary text into Base64, or Base64 → Text to turn a Base64 string back into readable text.

  2. Pick the alphabet, when encoding

    Under Alphabet, keep Standard (+ and /) unless the result is going into a web address or a file name; then choose URL-safe (- and _). Leave Padding on unless the system you are feeding asks for no = signs at the end.

  3. Paste what you want converted

    Type or paste into the box below the settings, replacing the sample. When decoding, line breaks and spaces in the Base64 are ignored, and either alphabet is recognised on its own.

  4. Convert and copy

    Press Convert to bring the answer into view; it has been updating as you type. Press Copy to take it.

  5. Check the round trip

    Press Use as input to send the answer back the other way. If your original comes back unchanged, the conversion is right.

Reading the result

  • Base64 or Text: the converted result, at the top.
  • Bytes in, Characters out and Overhead: how much data went in, how long the Base64 is, and how much longer that made it. Base64 is always longer than the original.
  • When decoding, Characters in, Bytes out and Alphabet show the same the other way round, and which alphabet the string used.
  • Decoded, but these bytes are not text: the Base64 held a file, such as a picture or a PDF, not words. The page shows the byte count and the first bytes instead.

If it goes wrong

  • Base64 is not a lock — anyone can turn it straight back into the original, so never use it to hide a password.
  • Decoding fails with a message about the length or the padding: part of the string is missing. Copy it again in full, including any = signs at the end.
  • An error says it mixes both base64 alphabets: two different strings have been joined together. Copy only the one you need.

What this is

Base64 rewrites arbitrary bytes using 64 printable characters, so they can travel through something that only carries text — a URL, an email header, a JSON string, an HTML attribute.

Text is converted to UTF-8 bytes first, and the bytes are what get encoded. That is what every other implementation means by "Base64 of a string", and it is why the peso sign, ñ and emoji all survive here. The browser function most online tools are built on top of is Latin-1 only: it throws an error on anything above U+00FF, and ₱ is U+20B1.

Decoding runs the same way in reverse, with one refusal. If the bytes are not valid UTF-8 — because you pasted an image, or a compressed file — the page will not render them as text. A lenient decoder turns them into a row of replacement characters, which looks like an answer and is not one. You get the byte count and a hex preview instead.

Questions

Is Base64 encryption?

No, and this is the mistake that matters. Base64 is a way of writing bytes using 64 printable characters so they survive a channel that only carries text — an email header, a data URL, a JSON string. Anyone can decode it in a second, including on this page. Never use it to hide a password, an API key or anything else you would not publish.

Why did my ₱ sign break in another tool?

Because it was encoded as Latin-1 rather than UTF-8. The peso sign is one character but three bytes, and the browser function most tools are built on refuses anything above 255 outright. This encodes the UTF-8 bytes, so ₱, ñ, Baybayin and emoji all survive a round trip intact.

What is the difference between the two alphabets?

Only the last two characters. Standard Base64 uses + and /, which both have a meaning inside a URL and have to be escaped. The URL-safe alphabet uses - and _ instead so the result can be dropped into a link or a filename untouched. Nothing else changes, and this page decodes either without being told which.

Why is my encoded text a third longer?

Because three bytes are rewritten as four characters. That is a 33% increase, plus up to two padding characters. It is the price of using only characters that survive being copied, pasted and emailed.

Can I paste something with line breaks in it?

Yes. Email attachments wrap Base64 at 76 characters a line, and copying from a terminal adds its own breaks. Whitespace is ignored on decoding, and the page tells you when it ignored some.

It says my bytes are not text. What does that mean?

You have decoded something that was never text — an image, a PDF, a compressed file. Rather than show you a row of replacement characters that looks like a broken answer, the page shows the byte count and the first bytes in hex so you can see what it actually is.

How it encodes

Three bytes become four characters
M a n 3 bytes = 24 bits
010011 010110 000101 101110 4 groups of 6
T W F u 4 characters
Why the = signs

Six bits do not divide into eight evenly, so a length that is not a multiple of three leaves a partial group. The padding says how many bytes the last group really held: one = means two bytes, two means one. Some systems drop them, so the page decodes with or without.

Worked example
f Zg==
fo Zm8=
foo Zm9v
₱ 4oKx

The first three are the RFC 4648 test vectors. The fourth is one character and three bytes, and it is the one that breaks a Latin-1 encoder.

Keep going

Important

Base64 is an encoding, not encryption — anything you encode here can be read by anyone who sees it. Nothing you type here is sent to our servers — the calculation runs entirely in your browser.