Base64 encoder and decoder

Encode text to Base64 or decode a Base64 string back to text.

Direction

Last updated: October 2026 · Report a calculation error

What is Base64?

Base64 writes any data — text, an image, a file — using 64 safe characters: A–Z, a–z, digits, “+” and “/”. Every 3 bytes become 4 characters, so encoded data is about a third longer. The “=” at the end pads the last group.

Example: “Hello, world” is SGVsbG8sIHdvcmxk. The converter first turns text into UTF-8 bytes, so accented characters work correctly: “Café” is Q2Fmw6k=.

Where Base64 is used

  • Email attachments (MIME) are sent as Base64.
  • Images embedded in HTML and CSS as data URIs: data:image/png;base64,…
  • JWT tokens, the HTTP Basic Auth header, keys and certificates in PEM format.
  • Sending binary data in JSON and XML, which only accept text.

Base64 is not encryption

Anyone can decode Base64 without a key — it is just another way of writing the same data. Never use it to hide passwords or personal data. Use encryption to protect data and hash functions such as SHA-256 to check integrity.

Frequently asked questions

Why does the decoded text look garbled?

The data may have been encoded in something other than UTF-8 (e.g. Windows-1252), or it isn’t text but a binary file. The converter tells you when the result isn’t valid UTF-8.

What is Base64URL?

A variant that uses “-” and “_” instead of “+” and “/” so the data can go into a URL — you’ll see it in JWT tokens, for example.

See alsoWhole category

  1. IT-02JSON formatter and validatorBeautify or minify JSON, check that it is valid and see exactly where a syntax error is.
  2. IT-03HEX / RGB / HSL color converterConvert colors between HEX, RGB and HSL with a live preview.
  3. IT-04SHA-256 hash generatorGenerate SHA-256, SHA-1 and SHA-512 hashes of any text.
  4. IT-05Unix timestamp converterConvert Unix timestamps to dates and dates to timestamps, in seconds or milliseconds.