Skip to content
CalcLab

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 back to text (UTF-8).
No data
No results yetEnter values and run the tool to see results.

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?

  1. Encoding first converts the text into UTF-8 bytes, so characters outside ASCII are represented correctly.
  2. Those bytes are taken three at a time — 24 bits — and re-split into four 6-bit groups.
  3. 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.
  4. 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.
  5. 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`.

  1. `Hi` is the two bytes 0x48 0x69.
  2. Two bytes is 16 bits, which splits into three 6-bit groups with 2 bits of padding.
  3. 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