# Base64 Encoder and Decoder

> Encode text to Base64 or decode Base64 back to text, using UTF-8, with standard or URL-safe alphabets as defined in RFC 4648. Runs in your browser.

Category: IT, networking & security · Applies to: Worldwide · Last updated: 2026-10-29
Interactive calculator: https://calculators.geekmidst.com/calculators/base64-encoder-decoder

Base64 turns bytes into 64 safe text characters, three bytes at a time into four characters, so binary data can travel through systems built for text.

Also called: Base64 converter, Base64 encode/decode.

## Inputs
- Action (options: Encode, Decode; default encode)
- Alphabet (options: Standard (+ /), URL-safe (- _); default standard)
- Text (default Hello, world!)

## Results
- Result
- Bytes of text (UTF-8)
- Characters in result

## Formula

```
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 =.
```

Where:
- = padding: one = when the last group has 2 bytes, two when it has 1 (omitted in the URL-safe variant)

## Worked example
1. "foo" is bytes 66 6F 6F = 011001 100110 111101 101111 → Z m 9 v.
2. "bar" is bytes 62 61 72 = 011000 100110 000101 110010 → Y m F y.

**Result:** "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.

## Sources
- [RFC Editor (RFC 4648: The Base16, Base32, and Base64 Data Encodings)](https://www.rfc-editor.org/)

## Related calculators
- [URL Encoder and Decoder](https://calculators.geekmidst.com/calculators/url-encoder-decoder)
- [Roman Numeral Converter](https://calculators.geekmidst.com/calculators/roman-numeral-converter)
- [Website Bandwidth Calculator](https://calculators.geekmidst.com/calculators/bandwidth-calculator)

Source: GM¹X CalcVerse — https://calculators.geekmidst.com/calculators/base64-encoder-decoder
