Skip to content
Devtoolry

Base64 Encode / Decode

Decode Base64 to text or encode text to Base64 online, with full UTF-8 and URL-safe Base64 support. Conversion runs in your browser, so nothing is uploaded.

Runs in your browser · Nothing uploadedFree · No sign-up

Something not working, or missing a feature? Send feedback

About the Base64 Encode / Decode

Base64 represents binary data with 64 printable characters so it can travel through text-only channels such as JSON, URLs and email. Use it to Base64 decode a string back to text or encode text to Base64, with full UTF-8 support.

Everything runs in your browser, so your input is never uploaded to a server.

How to use the Base64 Encode / Decode

  1. Choose Encode or Decode.
  2. Paste your text or Base64 string.
  3. Turn on URL-safe (Base64URL) for tokens and URLs, then copy the result.

Examples

Encode text

Input

Hello, world!

Result

SGVsbG8sIHdvcmxkIQ==

The == padding makes the length a multiple of 4.

Encode non-ASCII text

Input

café

Result

Y2Fmw6k=

Text is encoded as UTF-8 first, so accents, other scripts and emoji round-trip correctly.

Common mistakes

  • Base64 vs Base64URL. Standard Base64 uses + and /, which break URLs. JWTs and URL parameters use Base64URL with - and _ instead. Turn on URL-safe when decoding a JWT part.
  • Missing padding. Base64URL usually drops the trailing = characters. If a strict decoder rejects a value, add = until the length is a multiple of 4.
  • Line breaks in the input. Email (MIME) and PEM files wrap Base64 every 64 or 76 characters. Remove the line breaks and any -----BEGIN----- headers before decoding.
  • It is not encryption. Anyone can decode Base64. Never use it to hide passwords or API keys.

Works well with the Base64 Encode / Decode

Frequently asked questions

What is Base64URL?

A variant that uses - and _ instead of + and / and usually drops = padding, so the value is safe in URLs and file names. JWTs use it.

Is Base64 encryption?

No. Anyone can decode Base64; it is an encoding, not a way to protect data.

Why is Base64 about 33% larger?

Every 3 bytes of input become 4 printable characters, so encoded data is roughly a third larger than the original.

How do I decode Base64 in JavaScript?

atob() and btoa() handle only Latin-1 text. For UTF-8, use TextEncoder and TextDecoder with the bytes, or Uint8Array.fromBase64 in newer browsers.

Guides and tutorials