How to use this calculator
- Enter or choose action.
- Enter or choose alphabet.
- Enter or choose text.
- The result updates as you type. Use Copy result or Share to keep it.
Method
Take the UTF-8 bytes 3 at a time (24 bits), split into four 6-bit groups, and map each to A–Z, a–z, 0–9, + and / (or - and _). Pad a final partial group with =.
- = padding
- one = when the last group has 2 bytes, two when it has 1 (omitted in the URL-safe variant)
Worked example
- "foo" is bytes 66 6F 6F = 011001 100110 111101 101111 → Z m 9 v.
- "bar" is bytes 62 61 72 = 011000 100110 000101 110010 → Y m F y.
"foobar" encodes to Zm9vYmFy (the RFC 4648 test vector).
What the result means
Base64 output is about a third larger than the input. It is an encoding, not encryption: anyone can decode it.
Assumptions and limits
- Text is converted to bytes as UTF-8, the encoding used by the web.
- Decoding is limited to results that are valid UTF-8 text; Base64 that contains an image or other binary file cannot be shown as text.
Questions
Is Base64 encryption?
No. It only changes the representation of the data and can be reversed by anyone. Never use it to protect passwords or secrets.
What is the URL-safe variant?
RFC 4648 base64url replaces + with - and / with _ so the result can go in URLs and file names; the = padding is usually dropped.