Account

What new tool do you want?

Developer Tools

Base64 Encode / Decode

Encode text to Base64 or decode Base64 back to text, with full UTF-8 support and a URL-safe option.

How to use

  1. 1Choose Encode or Decode.
  2. 2Paste your text or Base64 string — the result updates instantly.

Frequently asked questions

What is Base64 used for?

It represents binary data as plain text, so it can travel safely in JSON, email, URLs, data: URIs and HTTP headers.

Is Base64 encryption?

No. Anyone can decode it instantly. It's an encoding for transport, not a way to hide information.

What is URL-safe Base64?

A variant (Base64url) that uses - and _ instead of + and / and drops = padding, so it can go in URLs and JWTs.

Worked example: Base64 Encode / Decode

Encoding "Hello, World!" produces SGVsbG8sIFdvcmxkIQ== — the trailing == is padding, added because Base64 always groups input into 3-byte chunks and this 13-byte string doesn't divide evenly by 3. Encode "héllo ✓" instead and you get aMOpbGxvIOKckw==; the é and ✓ expand to 2 and 3 UTF-8 bytes respectively rather than 1, which is why the output is proportionally longer than a plain-ASCII string of the same visible character count — Base64 encodes bytes, not characters.

Why URL-safe Base64 exists as a separate option

Standard Base64 uses + and / as two of its 64 symbols, and both characters are already meaningful inside a URL (+ can mean a space in query strings, / separates path segments) — so a Base64 string pasted directly into a URL can silently corrupt or get misinterpreted. Base64url swaps those two characters for - and _ (which are safe in URLs) and drops the = padding entirely, since padding can be reconstructed from the string's length when needed. This is exactly the variant JWTs use for their header and payload segments, which is why a JWT never contains a + or / character.

Why decoding sometimes succeeds but shows nothing readable

The decoder deliberately distinguishes two failure modes: Base64 that doesn't decode at all (the input isn't valid Base64 — wrong character set or an impossible length) versus Base64 that decodes fine as bytes but isn't valid UTF-8 text, which happens when you paste the Base64 of an actual binary file (an image, a font, a zip). In the second case the tool tells you explicitly rather than showing garbled replacement characters, since that's a completely different problem — the encoding is syntactically fine, it's just not text.

Why padding is optional on the way in, but added back on the way out

The decoder strips any trailing = characters from the input before doing anything else, then recomputes exactly how much padding is needed from the string's length and adds it back — which is why pasting SGVsbG8sIFdvcmxkIQ (no trailing ==) decodes correctly even though it's technically missing its padding. This tolerance matters because plenty of real systems (JWTs, some URL-safe encoders) omit padding deliberately, and a strict decoder that insisted on exact padding would reject perfectly valid data for no good reason. What it won't tolerate is a string whose unpadded length is impossible — a length that leaves a remainder of 1 when divided by 4 can never correspond to a whole number of bytes, so that specific case is rejected outright rather than guessed at.

Base64 always expands the data — by a predictable amount

Every 3 bytes of input becomes exactly 4 Base64 characters, because each output character encodes 6 bits and 3 bytes is 24 bits — so Base64 text is always about 33% larger than the original binary data, before any padding is added. That's an unavoidable cost of representing arbitrary bytes using only 64 printable characters, and it's the reason Base64 is used for transport (email attachments, JSON, data: URIs) rather than storage — if file size matters, the binary form is always smaller than its Base64 encoding, never the other way around.

Related tools

More: Developer Tools