What is Base64?
Base64 is a way to represent binary data using only 64 safe ASCII characters:
A–Z, a–z, 0–9, + and / (with
= as padding). It exists because many channels — email, JSON, URLs, XML — were designed
for text and mangle raw bytes. Base64 smuggles any file through a text-only pipe intact.
How it works
Every 3 bytes (24 bits) of input are split into four 6-bit chunks, and each 6-bit value (0–63) maps to
one character of the alphabet. Three bytes in, four characters out — which is why Base64 output is
always about 33% larger than the original. When input length isn't divisible by 3,
= padding fills the final group.
Where you meet it every day
- Data URIs —
data:image/png;base64,iVBOR…embeds an image directly in HTML or CSS, saving an HTTP request. - Email attachments — MIME encodes every attachment as Base64 text.
- JWTs — the header and payload are Base64URL-encoded JSON.
- API payloads — binary blobs inside JSON have no other standard representation.
- Basic auth — the
Authorization: Basicheader is Base64 ofuser:password.
The two classic mistakes
- Thinking it's encryption. Base64 is an encoding — fully reversible by anyone, no key involved. Never use it to "protect" secrets.
- Breaking Unicode. JavaScript's raw
btoa()throws on characters outside Latin-1 — accents, CJK, emoji. The fix is encoding the string as UTF-8 bytes first, which is exactly what our converter does.
Base64 vs Base64URL
Standard Base64 uses + and /, which clash with URL syntax. Base64URL swaps
them for - and _ and usually drops padding — that's the variant JWTs use.
Try it
The Base64 Fast converter encodes and decodes as you type, handles Unicode correctly, and turns any file or image into a ready-to-paste data URI — all without your data leaving the browser.