How to use
- Choose Encode text, Decode Base64 or Encode a file.
- Type or paste into the box. The result updates as you type.
- For encoding, pick the alphabet (standard or URL-safe), padding and line breaks.
- Press Copy, or Use as input to reverse the conversion.
Files are read on your device and never uploaded, up to 2 MB. Decoded data that isn’t text, such as an image, is shown in hex with a Download button.
How Base64 works
Base64 (RFC 4648) writes any bytes using 64 safe characters: A–Z, a–z, 0–9, + and /.
- Text is first turned into bytes with UTF-8, so é takes 2 bytes and most emoji take 4.
- The bytes are split into groups of 3 bytes = 24 bits.
- Each group becomes 4 characters of 6 bits each.
- If the last group is short, “=” pads the output to a multiple of 4.
So the output is about 33% longer than the input: 100 bytes become 136 characters.
Example
“foo” is the bytes 66 6F 6F, or 01100110 01101111 01101111. Regrouped into 6-bit pieces, 011001 100110 111101 101111 are 25, 38, 61 and 47, which are the characters Zm9v.
| Text | Base64 | URL-safe, no padding |
|---|---|---|
| f | Zg== | Zg |
| foobar | Zm9vYmFy | Zm9vYmFy |
| Hello, World! | SGVsbG8sIFdvcmxkIQ== | SGVsbG8sIFdvcmxkIQ |
| héllo 🌍 | aMOpbGxvIPCfjI0= | aMOpbGxvIPCfjI0 |
Padding, URL-safe Base64 and strict decoding
- Padding: one “=” means the last group held 2 bytes; “==” means 1 byte. Some systems, such as JWTs, drop it.
- URL-safe (base64url, RFC 4648 §5) uses “-” and “_” instead of “+” and “/”, which mean something in URLs.
- Decoding accepts both alphabets, missing padding and line breaks (MIME wraps lines at 76 characters). Any other character is an error, with its position.
- Not encryption: anyone can decode Base64. RFC 4648 says it offers no confidentiality.
Pasting Base64 into a link? Run it through the URL encoder too, or use the URL-safe alphabet.