Base64 Encode & Decode

Convert text to Base64 and back, with full Unicode and URL-safe support. Runs offline in your browser.

Encode text to Base64 or decode Base64 back to text, with full Unicode support and a URL-safe option. Runs entirely in your browser, so tokens, credentials and payloads you are debugging are never transmitted anywhere. Emoji, accented characters and non-Latin scripts round-trip correctly, which the browser console's own btoa() cannot do.

Mode

Text is encoded as UTF-8 first, so emoji, accents and non-Latin scripts round-trip correctly — the raw btoa() in your browser console throws on those. Decoding accepts both standard and URL-safe input, with or without padding.

Plain text
Base64 output

How Base64 Encode & Decode works

Base64 solves one specific problem: moving binary data through a channel that only reliably carries text. It takes three bytes at a time and re-expresses them as four characters drawn from a 64-character alphabet — A–Z, a–z, 0–9, plus `+` and `/` — with `=` used as padding when the input length is not a multiple of three. That is why Base64 output is always about 33% larger than the input: you are spending four characters to carry three bytes.

It shows up constantly: email attachments (MIME), data URIs that embed an image directly in HTML or CSS, HTTP Basic Authentication headers, the header and payload sections of a JWT, certificates in PEM format, and binary blobs stashed inside JSON.

The most important thing to understand is that Base64 is **not encryption**. It is an encoding, with no key and no secret. Anyone who sees a Base64 string can decode it instantly — this page does exactly that. If you find credentials Base64-encoded in a config file or an HTTP header, treat them as being written in plain text, because in every meaningful sense they are.

The Unicode handling deserves a mention because it trips people up. The browser's built-in `btoa()` only accepts Latin-1 characters and throws on anything else, which is why encoding an emoji or a Hindi string in the console fails. This tool encodes to UTF-8 bytes first and then applies Base64, so any text round-trips faithfully. Decoding reverses that, and if the decoded bytes are not valid UTF-8 — because the input was genuinely binary, like an image — you are told so rather than shown mojibake.

The URL-safe variant (RFC 4648 §5) swaps `+` and `/` for `-` and `_` and drops the padding, because the standard characters have special meaning inside URLs. Decoding here accepts both variants automatically and re-adds any missing padding.

How to use Base64 Encode & Decode

1

Choose encode or decode

Switching mode feeds the current result back into the input, so you can verify a round trip immediately.

2

Paste your text

Type it, paste it, or open a text file. For decoding, both standard and URL-safe Base64 are accepted, with or without padding.

3

Copy the result

Copy to clipboard or download as a text file.

Frequently Asked Questions

Is Base64 a form of encryption?
+
No, and this matters. It is a reversible encoding with no key — anyone can decode it in seconds. Never treat Base64 as a way to protect passwords, tokens or personal data.
Why does encoding emoji fail in my browser console?
+
The built-in btoa() only handles Latin-1 characters and throws on anything else. This tool encodes to UTF-8 first, so emoji, accents and non-Latin scripts all work correctly.
What is URL-safe Base64?
+
A variant that uses - and _ instead of + and / and drops the = padding, because those characters have special meaning in URLs. It is what JWTs use. Decoding here accepts both variants automatically.
Why is my encoded string longer than the original?
+
Base64 encodes every three bytes as four characters, so output is always about 33% larger. That overhead is the price of making binary data safe to transmit as text.
Can I decode a Base64 image?
+
This tool decodes to text. If the result is binary — like a PNG — you will be told rather than shown unreadable characters. To view an embedded image, paste its full data URI into your browser address bar.
What does the = at the end mean?
+
Padding. Base64 works in three-byte groups, and = marks that the final group was short. One = means the input ended one byte short of a group, two means two bytes short.
Is my text sent to a server?
+
No. Everything runs in your browser, so it is safe for debugging tokens and payloads. That said, never paste live production credentials into any website, including this one.
Is there a length limit?
+
No fixed limit — you are bounded only by your device's memory. Very large inputs may take a moment to encode.

Related tools