Base64 explained for developers and everyone else

You meet Base64 in email source code, API responses, CSS files and login tokens. Here is how it works and how to deal with it.

Open the tool: Base64 Decode and Encode

How Base64 works

Base64 takes 3 bytes (24 bits) at a time, splits them into four 6-bit groups and writes each group as one of 64 characters. If the data does not divide by 3, = signs pad the end.

Where you will see it

  • Email attachments (MIME), wrapped at 76 characters per line.
  • Data URIs that embed small images in HTML and CSS.
  • HTTP Basic authentication: user:password in Base64.
  • JSON Web Tokens, written in URL-safe Base64 without padding.

When not to use it

Embedding large images as Base64 makes pages heavier and stops browsers from caching them separately. Use it for small icons only, and never to hide sensitive data.