What is this calculator?
Encodes UTF-8 text to Base64 or decodes Base64 back to text. Base64 is an encoding, not encryption — it makes binary-safe text for transports that mishandle raw bytes, and anyone can reverse it.
Use it when:
- You need to embed data in a URL, a data URI, or an HTTP header.
- You are reading a Base64 payload from a token or an API response.
- A system requires binary-safe text and cannot carry raw bytes.
Intended for: Developers working with APIs, tokens, data URIs, and transport encodings.
How is this calculated?
- Encoding first converts the text into UTF-8 bytes, so characters outside ASCII are represented correctly.
- Those bytes are taken three at a time — 24 bits — and re-split into four 6-bit groups.
- Each 6-bit group indexes the 64-character Base64 alphabet (A–Z, a–z, 0–9, + and /), producing four output characters for every three input bytes.
- When the input length is not a multiple of three, the final group is padded with `=` so the length stays a multiple of four. This is why Base64 output is about 33% larger than its input.
- Decoding reverses the process: characters map back to 6-bit values, which recombine into bytes and are then interpreted as UTF-8 text.
Example
Encoding the text `Hi`.
- `Hi` is the two bytes 0x48 0x69.
- Two bytes is 16 bits, which splits into three 6-bit groups with 2 bits of padding.
- Those groups map to `S`, `G`, `k`, and one `=` pads the output to four characters.
Result: `Hi` encodes to `SGk=`.
Frequently asked questions
Is Base64 encryption?
No, and treating it as such is a security mistake. It is a reversible encoding with no key. Never use it to protect a password, token, or any secret.
Why does the output end in one or two equals signs?
Padding. Base64 works on three-byte groups; when the input does not divide evenly, `=` characters pad the final group so the output length is a multiple of four.
Why does my decode fail?
Usually the string is URL-safe Base64, which uses `-` and `_` in place of `+` and `/`. Replace them before decoding. Missing padding is the other common cause.
Assumptions
What this calculator takes as given:
- The transformation is performed in your browser; the text you paste is not uploaded or stored.
- Input is treated as UTF-8 text.
- Standard Base64 alphabet (`+` and `/`) with `=` padding.
- Decoded bytes are interpreted as UTF-8 text.
Limitations
What this calculator cannot know or does not model:
- URL-safe Base64 (`-` and `_`) is not decoded directly.
- Binary files are out of scope — this tool handles text.
- It provides no confidentiality whatsoever; it is an encoding, not a cipher.
References
- RFC 4648 — The Base16, Base32, and Base64 Data Encodings — IETF. The specification defining the alphabet and padding used here.