Base64 Encoder Decoder

Encode text to Base64 or decode Base64 strings.

What Base64 is, and what it is not

Base64 converts binary or text data into a set of 64 safe characters (letters, digits, plus and slash) so it can travel through systems that only handle plain text, such as email bodies, JSON and URLs. Three bytes of input become four characters of output, so the encoded version is about one third larger.

Important: it is not encryption

Base64 is an encoding, not a security measure. Anyone can decode it instantly, so never use it to hide passwords or personal data.

Worked example

The word Hi! is three bytes and encodes to SGkh. Padding with one or two equals signs appears at the end when the input length is not a multiple of three.

Where you will see it

  • Small images embedded directly in HTML or CSS as data URLs.
  • Email attachments.
  • The header and payload parts of JSON Web Tokens.

Frequently asked questions

Why does decoding fail?

Usually the text has stray spaces, is missing padding, or was not Base64 to begin with. URL-safe Base64 also swaps the plus and slash characters for minus and underscore.

Share this tool: