Base64 Encoder
Turn plain text into Base64 for transport or testing.
Base64 Encoder
Base64 Encoder converts text into Base64, the encoding used whenever binary or awkward data has to travel through something that only reliably handles plain text. Encoding happens in the page as you type, and the result can be copied in one click.
How to use it
- Paste or type the text you want to encode.
- The Base64 output appears immediately below.
- Use Copy Result to put it on the clipboard, or Clear to start over.
How Base64 works
Base64 takes three bytes at a time (24 bits) and re-cuts them into four groups of six bits. Each six-bit group becomes one character from a 64-character alphabet of A-Z, a-z, 0-9, plus, and slash.
When the input does not divide evenly into three bytes, the output is padded with one or two equals signs so the length is always a multiple of four. Because four characters carry three bytes, Base64 output is always about 33% larger than the input.
Worked example
Encoding the two-character string Hi:
- InputHi
- Bytes0x48 0x69
- Six-bit groups010010 000110 1001 + padding
Result: SGk= - three characters of data plus one equals sign, because two bytes is not a whole three-byte group.
When it helps
- Embedding a small image or font directly in CSS or HTML as a data URI, removing a network request.
- Building an HTTP Basic Authentication header, which is the Base64 of username:password.
- Moving configuration or a certificate through a form, a JSON field, or a chat message that would otherwise mangle it.
- Inspecting the payload of a JSON Web Token, whose segments are Base64url.
Common mistakes
- Treating Base64 as encryption. It is an encoding, not a cipher. Anyone can decode it instantly, so it hides nothing.
- Pasting Base64 into a URL without converting it. Standard Base64 uses plus and slash, which have their own meaning in URLs. The URL-safe variant swaps them for minus and underscore.
- Assuming it saves space. It costs roughly a third more than the original, so it is a compatibility tool, not a compression one.