PoliteTools

Developer

Base64 Encoder & Decoder

Encode text to Base64 or decode it back. Handles UTF-8 correctly, so accented characters, emoji and non-Latin scripts survive the round trip — which the naive browser approach does not. The URL-safe option produces the variant used by JWTs and query strings.

nothing you type is sent anywhere

Loading tool…

How to use Base64 Encoder

  1. Choose whether you are encoding text or decoding Base64.

  2. Paste your input.

  3. For encoding, tick URL-safe if the result will travel in a URL or a JWT.

  4. Copy the result.

What Base64 is actually for

Base64 exists to move binary data through channels that only reliably carry text. Email bodies, JSON string fields, XML documents, HTML data URLs and HTTP headers all expect text, and raw bytes passing through them get corrupted by encoding conversions, line-ending translation or control-character handling.

Encoding three bytes as four printable characters sidesteps all of that at a cost of roughly 33% size. That trade is worth it when the alternative is corruption, and pointless otherwise — encoding something that was already text, purely because it looks technical, is a surprisingly common piece of cargo-cult engineering.

The most visible everyday use is the data URL: an image encoded directly into a stylesheet or HTML document, avoiding a separate network request for something small.

Base64 is not encryption, and the confusion is dangerous

This needs stating plainly because it appears in production systems with real consequences. Base64 is reversible by anyone, with no key and no secret involved. A password stored as Base64 is stored in plain text with a step that filters out only the incurious.

The confusion arises because encoded text looks scrambled, and looking scrambled is what most people associate with being protected. It is worth internalising the distinction: encoding changes representation, encryption changes access. Only one of them requires a key.

If you find Base64 used as protection in a codebase, treat it as a finding rather than a style preference. The data it was protecting should be considered exposed.

URL-safe encoding, and why JWTs need it

Standard Base64 uses plus and forward slash for its last two characters, and equals for padding. All three carry meaning in a URL: plus is a space in a query string, forward slash is a path separator, and equals separates a parameter from its value. A standard Base64 string dropped into a URL therefore arrives corrupted.

URL-safe Base64 substitutes hyphen and underscore and omits the padding. JWTs use this variant for all three segments, which is why a JWT segment pasted into a standard decoder sometimes fails with a padding error.

When decoding, it is worth accepting both forms rather than making the user work out which they have — this page does, restoring the padding and translating the characters automatically.

Why non-ASCII text breaks so many Base64 tools

The browser's built-in encoding function handles only characters up to U+00FF and throws on anything above it. Tools that call it directly therefore fail on Hindi, Chinese, Arabic, Japanese, emoji, and even on curly quotes pasted from a word processor.

The correct approach is to encode the text to UTF-8 bytes first and then Base64 those bytes, which is what this page does. Decoding reverses it, interpreting the decoded bytes as UTF-8 rather than as individual characters.

It is worth testing any encoding tool you rely on with a non-ASCII string before trusting it with real data. Silent corruption of names and addresses is a genuinely common bug in systems that assumed English.

Frequently asked questions

What is the difference between Base64 and URL-safe Base64?

Standard Base64 uses + and / as its final two characters, plus = for padding. All three have meaning in a URL, so a token in a query string gets mangled. URL-safe Base64 substitutes - and _ and drops the padding. JWTs use the URL-safe variant throughout, which is why a JWT segment pasted into a standard decoder sometimes fails.

Why does encoding make my text longer?

Base64 represents three bytes using four characters, so output is roughly 33% larger than input. That is the cost of the format: it exists to move binary data safely through channels that only reliably carry text, not to compress anything. Encoding something already compressed makes it bigger, never smaller.

Is Base64 a form of encryption?

No, and treating it as one is a genuine security mistake that appears in production systems regularly. Base64 is an encoding — reversible by anyone, with no key involved. A password stored as Base64 is stored in plain text with an extra step. If you need secrecy, you need encryption.

Why do accented characters break in other tools?

Because the browser's built-in btoa function only handles characters up to U+00FF and throws on anything else. Tools that call it directly fail on any non-Latin text. This page encodes to UTF-8 bytes first, so Hindi, Chinese, emoji and accented Latin all round-trip correctly.

Is anything I paste sent to a server?

No. Everything runs in your browser using JavaScript, so nothing you paste is transmitted, stored or logged, and the page keeps working if you go offline after it loads. This matters more for developer tools than for most: the things people paste into them are API responses, tokens, connection strings and production data, and a great many popular online utilities do send that to a server.

What next