What Is Base64 Encoding? Encode and Decode Explained

What Is Base64 Encoding? Encode and Decode Explained

You have almost certainly seen a string of letters, digits, plus signs and slashes that means nothing at a glance — something like SGVsbG8=. It is not a password, and it is not a secret code. It is Base64: a way of writing data as plain text so it can travel through systems that only understand text. This guide explains what Base64 encoding is, how it works, where you meet it, and how to encode and decode it yourself in seconds.

The short version is this: Base64 takes any data — text, a picture, a file — and turns it into a string of 64 safe characters. The result is longer than the original, but it can be copied, pasted, emailed and stored anywhere plain text can go. The free Base64 Encoder & Decoder on this site does both directions in your browser, with nothing uploaded.

What is Base64?

Base64 is an encoding scheme, not a format for a particular kind of data. It works by taking the data three bytes at a time and splitting those 24 bits into four groups of six bits. Each six-bit group is a number from 0 to 63, and each number maps to one character in a fixed alphabet: A to Z, a to z, 0 to 9, then + and /. If the data does not divide evenly into groups of three bytes, the output is padded with one or two = signs. That is the whole trick — every possible byte becomes one of 64 characters that nearly every system accepts.

Worked example: Hello becomes SGVsbG8=

Take the word Hello. In UTF-8 its five letters are five bytes, and those five bytes become eight Base64 characters: SGVsbG8=. The = at the end is padding, because five bytes do not divide evenly into groups of three. Decode SGVsbG8= and you get Hello back. Try it in the Base64 Encoder & Decoder: press Try an example, then press Decode, and watch the result turn back into the word you started with.

Where you meet Base64

Base64 is easy to miss because it hides in plain sight. You meet it in:

  • Email attachments. A photo attached to an email is carried as Base64 text, because email was built for words, not pictures.
  • Web addresses and tokens. The middle part of a JSON Web Token is Base64, and data URLs embed small images as Base64 strings.
  • APIs and keys. Services pass signatures, keys and binary values as Base64 so they survive being copied into headers and settings files.
  • Configuration files. Binary values are stored as Base64 text so they can be pasted, printed and emailed without damage.

Encode and decode it yourself

Encoding and decoding takes seconds with the right tool. Paste text into the Base64 Encoder & Decoder and press Encode, or paste a Base64 string and press Decode. The tool handles UTF-8, so accents, currency signs and emoji come through correctly — something the plain btoa() function in JavaScript cannot do, because it only understands basic Latin characters. It also checks what you paste: if the string is not valid Base64, it says so instead of giving you a wrong answer.

Why does Base64 make data bigger?

Every three bytes of input become four characters of output, so an encoded file is about 33% larger than the original. That is the price of safety: the output only uses characters that text systems accept. It is also why Base64 is a poor choice for large files — a 10 MB image becomes a 13 MB string. For small values, tokens and short attachments, the extra size does not matter; for a video, you would never use it.

Is Base64 encryption?

No, and this is the most important thing to remember. Base64 changes how data looks, not who can read it. Anyone who finds a Base64 string can decode it in seconds — with this tool, for example. It gives no secrecy at all. Never store a password, an API key or anything private as Base64 and assume it is hidden. If something must be secret, encrypt it with a proper method and keep the key safe.

Frequently asked questions

What characters does Base64 use?
The letters A to Z, a to z, the digits 0 to 9, plus + and /. A trailing = is padding. Together that is 64 characters, which is where the name comes from.

Why does a Base64 string end in =?
The data did not divide evenly into groups of three bytes, so = signs fill the last group out to four characters. One = means the last group had two bytes; two = means it had one.

Can Base64 hold a file?
Yes. Any file can be Base64-encoded, and email attachments are exactly that. But the size grows by a third, and the result is still just text — it is not a file format of its own.

Base64 is a small idea with a large job: it lets binary data travel through a text-only world. Once you can recognise the alphabet — and the = at the end — the strange strings you meet in emails, tokens and settings files stop being a mystery. Try the free Base64 Encoder & Decoder next time one appears, and browse the full tools directory for more free tools.