How this calculator works
Base64 reads three bytes, or 24 bits, at a time and splits them into four 6-bit values. Each value maps to one of 64 printable characters, so every three bytes become four characters and the text grows by a third. When the input is not a multiple of three bytes, the last group is padded with equals signs. The mapping is a transport encoding, not encryption: anyone can decode it, and a password hidden this way is still readable. This page encodes the text as UTF-8 first, which is why an accented character can take two bytes and an emoji four.
Formula
encoded length = 4 x ceiling(byte length / 3). Each group of three bytes (24 bits) becomes four 6-bit characters. Padding with one equals sign means two bytes in the last group, and two equals signs mean one byte.
Worked example
The word Mathulate is nine ASCII bytes, so it becomes three groups of three bytes and 12 Base64 characters: TWF0aHVsYXRl. The word Hi is two bytes, so the last group holds two bytes and one equals sign is added: SGk=. Decoding SGVsbG8= returns Hello, which is five bytes of UTF-8.
Advertisement
Frequently asked questions
Is Base64 encryption?
No. It is a reversible encoding with no key. Anyone can decode it instantly, so it protects data against systems that cannot handle raw bytes, not against people who want to read it. Use encryption when confidentiality matters.
Why does Base64 make my data longer?
Four characters carry three bytes, so the encoded text is four thirds of the original size, about 33 percent longer, plus up to two padding characters. Binary attachments in email are larger for this reason.
What does the equals sign at the end mean?
It pads the final group to four characters. One equals sign means the last group carried two bytes, two equals signs mean one byte, and no padding means the input was a multiple of three bytes. Some tools drop the padding; this page accepts padded or unpadded input.
Why do I get an error when decoding?
Either the characters are not in the Base64 alphabet or the bytes they represent are not valid UTF-8 text, for example an image. Base64 can carry any bytes; this page only turns bytes back into text when they form valid UTF-8.