Skip to content
Technology·1 min read·

Base64 encode and decode

Encode UTF-8 text as standard Base64, or decode a padded Base64 string back to text.

The answer

Encoding turns UTF-8 bytes into the standard Base64 alphabet with padding. Decoding accepts that alphabet only and returns the UTF-8 text.

Result

Base64

aGk=

What do you want to do next?

How this works

The encoder uses the standard alphabet of letters, digits, plus, and slash, with equals signs for padding, as described in RFC 4648. The input is UTF-8, not a file upload.

The decoder rejects characters outside that alphabet and rejects a length that is not a multiple of four. URL-safe Base64, which uses minus and underscore, is not accepted here.

Practical steps

  1. 1

    Choose encode or decode.

  2. 2

    Paste the text or the Base64 string.

  3. 3

    If decoding fails, check for a missing padding character or a character that is not in the standard alphabet.

Examples

  • Encode “hi”

    aGk=

Common mistakes

  • ×

    Pasting a URL-safe token into the standard decoder and treating the error as a broken secret.

Frequently asked questions

Does this accept Base64URL?

No. Swap minus for plus and underscore for slash, and add padding, before decoding.

Is the result encrypted?

No. Base64 is an encoding. Anyone can decode it.

Sources