Open an email's source, a JSON payload or a configuration file and sooner or later you meet a string like SGVsbG8sIFdvcmxkIQ==: a long run of letters and digits, no spaces, ending in equals signs. It looks scrambled, almost encrypted. It is neither. It is Base64, one of the most common encodings in computing, and once you understand the simple counting trick behind it, strings like that stop looking mysterious.

This guide explains what Base64 is, why it exists, and how the encoding actually works, then shows you how to encode and decode text yourself with the free Base64 Text Encoder/Decoder on Ovatly.

Contents

  • Quick answer
  • The problem Base64 solves
  • How Base64 works: 64 characters, 6 bits each
  • Why the output is about a third larger
  • How to encode and decode text, step by step
  • Worked example: a greeting and an accented word
  • Limitations and honest warnings
  • Common mistakes
  • FAQs
  • Conclusion

Quick answer

Base64 is an encoding that rewrites data using a small alphabet of 64 characters: the letters A to Z and a to z, the digits 0 to 9, and two extra symbols. Because the result is ordinary text, it can pass safely through channels that only handle text, such as JSON, email and data URIs. Each character carries 6 bits of the original data, so every three bytes turn into four characters and the encoded output is about a third larger than the input. Encoding and decoding need no key and no permission. Base64 is a transport format, not a security measure, and the Base64 Text Encoder/Decoder converts text in both directions in your browser.

The problem Base64 solves

Plenty of systems were built to move text and nothing else. Email was designed for plain text messages. JSON is a text format. A data URI embeds content inside a text address. Raw bytes do not travel well through channels like these: control characters, null bytes and values outside the printable range get stripped, mangled or rejected by software along the way.

Base64 is the workaround. It takes data that looks binary and re-expresses it using only characters that every text system can carry without damage. The data itself does not change; only its spelling changes. At the far end, the receiver decodes the text and recovers the original bytes exactly. That is the whole job of the format, and it is why you meet it inside email attachments, embedded assets, API payloads and configuration values.

How Base64 works: 64 characters, 6 bits each

The name is the recipe. Base64 uses an alphabet of 64 characters, and 64 is 2 to the power of 6, so each character in the alphabet can stand for exactly 6 bits of data.

Bytes, though, come in groups of 8 bits. The encoding lines the data up in chunks of three bytes, which is 24 bits, and 24 divides neatly by 6 into four pieces. So every three bytes of input become exactly four Base64 characters. That is why genuine Base64 strings are built from groups of four characters, and why their total length is a multiple of four once padding is counted.

Real data rarely ends on an exact three-byte boundary. When the final chunk holds only two bytes, it produces three characters plus one = sign. When it holds a single byte, it produces two characters plus ==. The equals signs are padding: bookkeeping that marks how many bytes were in the final partial group, not part of the data itself. This decoder accepts strings with or without padding, which is handy because some systems strip it.

There is also a URL-safe variant. The standard alphabet's two extra symbols can clash with characters that have a special meaning in web addresses, so the variant swaps them for - and _. The tool accepts both the standard form and the URL-safe variant when decoding, so you can paste either one as it is.

Why the output is about a third larger

The size growth follows directly from the counting. Four characters carry what three bytes carried, so the encoded form needs roughly four thirds as much room: about a third larger than the input. A 300-byte value becomes about 400 characters of Base64. Short inputs can look worse than the average, because padding rounds the final group up to four characters, but for anything of real size the third-larger figure is the one to expect. That overhead is the price of making data safe for text-only channels, and it is normal rather than a sign of a problem.

How to encode and decode text, step by step

  1. Open the Base64 Text Encoder/Decoder.
  2. Paste plain text, or paste a Base64 string. Both go into the same box.
  3. Press Encode to Base64, or Decode from Base64.
  4. Read the result, or read the validation error. If the input is not real Base64, or it decodes to bytes that are not valid UTF-8 text, the tool says so instead of printing mojibake.
  5. Copy the result.

Everything runs locally in your browser, and the tool is fully Unicode safe, so accented characters, emoji and non-Latin scripts survive the round trip intact.

Worked example: a greeting and an accented word

Start with the tool's own example. Encoding the text "Hello, World!" gives:

SGVsbG8sIFdvcmxkIQ==

The original is 13 bytes. Thirteen is four full groups of three bytes, plus one byte left over, and that leftover byte is exactly why the output ends in ==: the final group holds two characters and two padding signs. Paste the encoded string back in, press Decode from Base64, and "Hello, World!" comes back unchanged.

The second example shows the Unicode handling. The word "café" encodes to Y2Fmw6k=, this time with a single padding sign, because its UTF-8 form is five bytes: one full group of three, then a final group of two. Decode it and you get "café" back exactly, accent included. A decoder that treats text as single-byte characters would corrupt that word; this one does not, and the same applies to emoji and non-Latin scripts.

Limitations and honest warnings

Base64 is an encoding, not encryption, and that is the warning that matters most. An encoded password, key or personal detail is readable by anyone who sees it, instantly, with no key and no effort. Never use Base64 to protect secrets, and never treat an encoded value in a config file as hidden. Passwords belong in a proper hash like bcrypt, never in Base64.

This tool is for text. If a string decodes to bytes that are not valid UTF-8 text, the tool reports that instead of guessing at the output, and binary data belongs in a file tool. Images are a separate job as well: the Base64 Image Encoder in the Image Tools category produces a data URI for those.

And keep the size overhead in mind when you plan payloads. Encoded data runs about a third larger, which is usually fine for values and small assets, but it adds up across a large API response or a long email thread.

Common mistakes

  • Treating Base64 as a security measure. It is a transport format. Anything encoded is public to anyone who can see it.
  • Assuming a missing = means the string is broken. Padding marks the final partial group, and this decoder accepts strings with or without it.
  • Confusing the URL-safe variant with corruption. A string containing - and _ is usually the URL-safe variant, and the decoder accepts it as it is.
  • Decoding binary data as text. A string that decodes to non-UTF-8 bytes produces an error here, correctly. Use a file tool for binary data.
  • Trying to encode an image in the text tool. Use the Base64 Image Encoder in the Image Tools category, which is built for that and returns a data URI.

FAQs

Why does the output end with = signs? Base64 works in groups of four characters. The = signs are padding that mark how many bytes were in the final partial group.

Is Base64 a form of encryption? No. Base64 is an encoding, not encryption. Anyone who sees the string can decode it instantly, with no key, so never use it to protect secrets.

Why is the encoded output longer than the input? Each character carries only 6 bits, so three bytes become four characters. The output is about a third larger than the input, which is the normal Base64 overhead.

Can I encode an image here? This tool is for text. For images, use the Base64 Image Encoder in the Image Tools category, which produces a data URI.

Is Base64 safe for passwords? No. It is instantly reversible by anyone. Passwords belong in a proper hash like bcrypt, never in Base64.

Conclusion

Base64 exists for one reason: to spell data in characters that text-only channels can carry. Six bits per character, four characters per three bytes, a little padding at the end, and about a third more size is the entire mechanism. The Base64 Text Encoder/Decoder handles the standard and URL-safe variants, padding or no padding, and Unicode text without corrupting it. If you are wondering how Base64 compares with the other encoding you will meet when reading raw bytes, Base64 vs Hex Encoding puts the two side by side. For more tools like these, see the Developer Tools guide archive.