Developer Tools

Base64 Encoder & Decoder

Encode text to Base64, or decode a Base64 string back to plain text. Runs entirely in your browser.

What is Base64?

Base64 is a way of representing binary or text data using only 64 printable characters (A-Z, a-z, 0-9, +, /). It's not encryption — anyone can decode it instantly — but it's useful for safely embedding data in places that only accept plain text, like URLs, JSON, or email attachments.

Common uses

  • Embedding small images directly in HTML or CSS as a data URL
  • Passing binary-ish data through systems that only handle text, like some APIs
  • Quickly inspecting what a Base64 string in a config file or token actually says

Worked examples

Hello, World! encodes to SGVsbG8sIFdvcmxkIQ==. Accents and other scripts are handled by converting to UTF-8 first, so café becomes Y2Fmw6k= and 日本 becomes 5pel5pys. Every 3 bytes become 4 characters, which makes the output about a third longer, and the equals signs pad the end: a is YQ==, ab is YWI= and abc is YWJj.

How decoding behaves

  • Spaces and line breaks in the input are ignored, and missing padding is accepted, so SGVsbG8 decodes to Hello.
  • Only the standard alphabet works. The URL-safe variant used inside tokens, with - and _ instead of + and /, produces an error until you swap those characters back.
  • The decoded bytes are read as UTF-8 text. If the data is not text, such as an image, you will see replacement characters rather than an error message.
  • Anything that is not valid Base64, or whose length cannot be valid, shows an error.

Good to know

Base64 is an encoding, not protection: it hides nothing from anyone who looks. It is also a text converter only. To turn a picture into a data URL use the Image to Base64 tool, and to read the readable parts of a login token use the JWT Decoder, which handles the URL-safe form.

Guide

Frequently asked questions

Is Base64 the same as encryption?

No — Base64 is just a different way of representing the same data as plain text characters. Anyone can decode it instantly; it provides no security or privacy on its own.

Why did decoding fail with an error?

The input contained characters outside the standard Base64 alphabet (A-Z, a-z, 0-9, +, /, and = for padding) or had an impossible length. The most common cause is URL-safe Base64, which uses - and _; swap them for + and / and try again. Spaces and line breaks are ignored and don't cause errors.

Why is the encoded text longer than the original?

Base64 turns every 3 bytes into 4 characters, so the result is roughly a third larger, plus padding. That is the price of using only safe printable characters.

Why do I see strange characters after decoding?

The decoded bytes are shown as UTF-8 text. If the original data was binary, such as an image or a compressed file, it can't be shown as readable text and appears as replacement characters.

Can I decode the parts of a JWT here?

Only after converting them. Tokens use the URL-safe alphabet, so replace - with + and _ with /, or use the JWT Decoder, which does it for you.

Related tools