How Base64 encoding and decoding works
From bytes to text
Base64 groups three bytes into 24 bits, splits them into four 6-bit values, and maps each value to a character. With padding, the output length is 4 × ceil(bytes ÷ 3). Base64url uses - and _ where standard Base64 uses + and /.
Worked example
Hello becomes SGVsbG8=. The five UTF-8 bytes use eight output characters including one padding character. Decoding returns the original five bytes.
Text, files and validation
Text is interpreted as UTF-8. A file can contain any bytes. Decoding accepts line breaks, spaces, tabs and omitted padding. Invalid alphabets, incorrect padding and nonzero unused bits are rejected. Text input can contain up to 1 MiB of source bytes and files up to 8 MiB before encoding. Long outputs show a preview and can be downloaded in full.
IETF RFC 4648 · The Unicode Standard
For data sizes and transfer estimates, use the Bandwidth Calculator.
Common questions
Does Base64 protect the contents?
Base64 represents bytes as text. Anyone who can read the encoded text can decode it.
What if the decoded bytes are binary?
Download the decoded bytes to preserve the original content. The text preview appears when the bytes form valid UTF-8.
How do I use Base64 in a URL-safe format?
Select Base64url. Choose whether to omit padding based on the format expected by the receiver.