LocalToolkit
HomeEncoding & Decoding › Base64 Encoder / Decoder

Base64 Encoder & Decoder

Two-way text conversion, correct for UTF-8 and for the URL-safe alphabet.

🔒 Runs in your browser. Nothing is uploaded — verify it in the network panel, or disconnect and try again.

How Base64 works, in numbers

Base64 takes three input bytes (24 bits) and re-splits them into four 6-bit groups, each mapped to one character of a 64-character alphabet. That is why the encoded size is always about 4/3 of the original — a 33 percent inflation — and why the output length is always a multiple of four, padded with = when the input is not a multiple of three bytes.

Input bytesBitsOutput charsPadding
3244none
2164one =
184two ==

The alphabet has two dialects

Standard Base64 uses + and /, which are unsafe inside a URL or a filename. Base64URL (RFC 4648 §5) substitutes - and _ and usually strips the padding. JWT, OAuth, and most modern APIs use Base64URL — if you decode a JWT segment with a standard decoder and see garbled output, the alphabet is the reason.

Three situations where Base64 is the right answer

What Base64 is not

Base64 is encoding, not encryption. Anyone can reverse it in one step, with no key. If you need confidentiality the payload must be encrypted first — and if you Base64-encode a secret in a config file, you have published it in a slightly less readable font.

Decoding things that fail

A decoder that returns an error is telling you something useful. Common causes: padding removed by a URL round-trip, + turned into a space by a form or query-string parser, the URL-safe alphabet being fed to a standard decoder, or a truncated paste. This tool accepts both alphabets and tolerates missing padding, which covers all four.

How to use it

  1. Paste your text, or paste a Base64 string to reverse it.
  2. Choose the alphabet — standard for files and MIME, URL-safe for tokens.
  3. Read the result; the byte count updates so you can see the 33 percent overhead.

Worth knowing

  • Encoded output is always a multiple of four characters when padding is kept.
  • Alphabet size is exactly 64, which maps cleanly onto six bits.
  • Base64URL is defined in RFC 4648 §5 and drops padding in JWT usage.
  • MIME Base64 inserts a line break every 76 characters, per RFC 2045.

Limitations

  • Encoding adds 33 percent to the size — do not use it as compression.
  • It provides zero confidentiality.
  • Whitespace and newlines are ignored on decode, but stray characters will fail.
  • Very large payloads are limited by available tab memory.

Frequently asked questions

How do I decode Base64 to an image?
If you have a data URI of the form data:image/png;base64,..., copy everything after the comma into the decoder here to inspect the bytes. To save it as a file, decode in your language of choice and write the bytes with the image extension the MIME type indicates.
Why does my Base64 contain `-` and `_`?
It is Base64URL. - replaces + and _ replaces / so the string survives URLs and filenames. Decode it with the URL-safe alphabet here.
Is Base64 the same as encryption?
No. Decoding requires no key and is a single deterministic step. Never treat Base64 as protection for a password, token or personal data.
Why does Base64 end with `=`?
To pad the final group to four characters. Two input bytes need two output characters plus ==; one input byte needs three plus =. Some systems strip it, and strict decoders reject the shorter form.
Related tools
Hex Encoder / DecoderJWT DecoderURL Encoder / DecoderHTML Entity Encoder / DecoderROT13 CipherQuery String Parser
Keep reading
How browser-only processing worksAll Encoding & Decoding toolsEvery tool on the site