Skip to content

Base64 Encoder and Decoder

Paste text to encode it as Base64, or paste a Base64 string to decode it. Everything runs in your browser and nothing is uploaded.

Result

Base64
SGVsbG8sIFdvcmxkIQ==
URL-safe Base64
SGVsbG8sIFdvcmxkIQ
Input bytes
13
Output characters
20

Formula

  • Every 3 bytes (24 bits) become 4 characters of 6 bits each
  • Alphabet: A to Z, a to z, 0 to 9, + and /
  • Output length = 4 × ⌈bytes ÷ 3⌉, padded with =

How the Base64 Encoder and Decoder works

Base64 turns arbitrary bytes into text that survives systems built for plain characters, such as email and JSON. It regroups the data into 6-bit chunks and maps each to one of 64 printable characters.

The encoded form is about 33 percent larger than the original. Base64 is an encoding and not encryption. Anyone can decode it, so it offers no secrecy.

The URL-safe variant replaces + with - and / with _ and usually drops the = padding, so the string can be used in web addresses and file names.

Worked example

"Hello, World!" is 13 bytes. Its Base64 form is SGVsbG8sIFdvcmxkIQ== which is 20 characters including two padding characters.

Frequently asked questions

Why does Base64 end with equals signs?

The equals sign is padding. It fills the last group when the input length is not a multiple of three bytes. One = means two bytes were in the last group, and == means one.

Is Base64 secure?

No. It is a reversible encoding with no key. Never use it to protect passwords or private data.

Related calculators

All text, code and network calculators · All calculators

Related unit converters

Calculations run in your browser and nothing you enter is sent to a server. Results are provided for general information. Check critical figures independently before relying on them.

☕ Like this tool?

Buy me a coffee to support development

☕ Support UnitGenie

If this tool has been helpful, consider buying me a coffee to support development and keep it free for everyone!