How to use the Base64 tool

  1. Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
  2. Type or paste into the left box. The result updates as you type.
  3. Tick URL-safe alphabet if the value will appear in a URL, a filename, or a JSON Web Token. This replaces + with -, / with _, and removes the = padding.
  4. Click Use result as input to reverse the operation and confirm that the round trip gives back the original text.

When decoding, the tool accepts both the standard and URL-safe alphabets, ignores spaces and line breaks, and adds missing padding automatically.

What Base64 does

Base64 represents any sequence of bytes using only 64 printable characters: A–Z, a–z, 0–9, +, and /. Every 3 bytes of input become 4 characters of output, so encoded data is about 33% larger than the original. When the input length is not a multiple of 3, one or two = characters pad the end.

It exists so binary data can travel through systems that only handle text safely: email attachments (MIME), data URLs in HTML and CSS, HTTP Basic authentication headers, and JSON fields that need to carry images or keys.

Example

The text Hi! is three bytes, 0x48 0x69 0x21. Those 24 bits are split into four 6-bit groups, 010010 000110 100100 100001, which map to the characters SGkh.

Text in other scripts works the same way once it is converted to UTF-8 bytes. Hello, 世界 encodes to SGVsbG8sIOS4lueVjA==, because each Chinese character takes three bytes in UTF-8.

Things to know

  • Base64 is not encryption. Anyone can decode it instantly. Never use it to hide passwords or API keys.
  • Character encoding matters. This tool always converts text to UTF-8 before encoding. Some older tools use Latin-1 or UTF-16 and give different output for non-English text.
  • Decoded output may not be text. If the Base64 holds an image, a ZIP file, or encrypted data, the bytes are not valid UTF-8 and the tool tells you so instead of showing garbled characters.
  • Line breaks. MIME email wraps Base64 at 76 characters per line. Those line breaks are not part of the data and are ignored when decoding here.

Frequently asked questions

Why does my Base64 end with one or two equals signs?

The = characters are padding. They tell the decoder that the last group of 4 characters represents only 2 bytes (one =) or 1 byte (two =). URL-safe Base64 usually leaves them out, which is why this tool restores them before decoding.

What is the difference between Base64 and Base64URL?

They use the same method but two different characters. Standard Base64 uses + and /, which have special meanings in URLs. Base64URL uses - and _ instead. JSON Web Tokens use Base64URL, which is why you can read a token's contents with the JWT Decoder.

Is my data uploaded?

No. Encoding and decoding run in your browser with the built-in btoa, atob, TextEncoder, and TextDecoder functions.