Base64 Encoder / Decoder

Convert plain text to Base64 or decode a Base64 string back to readable text, with UTF-8 support and instant error feedback on invalid input.

Plain text

Base64

Invalid input for current mode, or nothing typed yet.

Example input

Hello, world!

Example output

SGVsbG8sIHdvcmxkIQ==

What is a Base64 Encoder / Decoder?

Base64 is a way of representing binary or text data using only 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It doesn't compress or encrypt anything — it just re-encodes data into a format that's safe to put inside places that don't handle raw binary well, like email bodies, URLs, JSON strings, or HTML attributes. This tool converts text to Base64 and back, with proper UTF-8 handling so accented characters and emoji round-trip correctly, which is a common source of bugs in simpler Base64 tools that only handle plain ASCII.

When to use it

You'll run into Base64 most often when embedding a small image directly in CSS or HTML as a data URI, decoding the payload of a JWT to inspect it, reading Basic Auth credentials out of an HTTP Authorization header, or debugging why an API is sending back a garbled string that turns out to just be Base64-encoded JSON. It's also common when working with email (MIME attachments are Base64-encoded) or when a config file stores a binary secret as text.

How it works

Encoding works by taking your text's UTF-8 byte representation and mapping every group of 3 bytes to 4 Base64 characters, using padding (=) when the input isn't a multiple of 3 bytes. This tool uses the browser's built-in btoa()/atob() functions, but wraps them with encodeURIComponent/decodeURIComponent so multi-byte UTF-8 characters (like emoji or accented letters) don't break — a raw btoa() call alone will throw or corrupt data on anything outside the Latin1 range, which is the most common bug people hit when Base64-encoding by hand.

Frequently asked questions

Is Base64 the same as encryption?

No. Base64 is an encoding scheme, not encryption — anyone can decode it instantly with no key or password. Never use Base64 alone to protect sensitive data; use it purely for safely representing data as text, and use actual encryption (like AES) if you need confidentiality.

Why does my Base64 string end with one or two = signs?

The = characters are padding. Base64 encodes data in 3-byte chunks; if your original input isn't a multiple of 3 bytes, padding is added so the output length stays a multiple of 4 characters. One = means the input had 2 bytes left over, two = means 1 byte was left over.

Why did decoding my Base64 string fail or produce garbage?

The most common cause is that the string isn't actually Base64 — for example, it's URL-safe Base64 (which uses - and _ instead of + and /), or it has line breaks or extra whitespace mixed in. Strip whitespace and swap URL-safe characters back before decoding.

Can I Base64-encode an image, not just text?

Yes, but for images specifically this site has a dedicated Image to Base64 Converter that handles binary image data and produces a ready-to-use data:image/... URI, which is more convenient than converting through plain text.