Base64 Encode/Decode

Encode text to Base64 or decode Base64 strings to text. Supports Unicode characters. Perfect for users needing a base64 decode image.

How to use Base64 Encode/Decode

  1. 1

    Select "Encode" or "Decode" mode.

  2. 2

    Enter your text in the input box.

  3. 3

    Copy the result from the output box.

Frequently Asked Questions

What is Base64 encoding used for?

Base64 encodes binary data (images, files, binary strings) as ASCII text so it can be safely embedded in JSON, HTML, CSS, or transmitted over text-only channels like email.

Is Base64 the same as encryption?

No — Base64 is encoding, not encryption. Anyone can decode a Base64 string instantly. Never use it to "hide" sensitive data. Use proper encryption (AES, RSA) for security.

What is the difference between Base64 and Base64URL?

Standard Base64 uses + and / characters, which are not URL-safe. Base64URL replaces + with - and / with _ to produce strings that can safely appear in URLs and JWT tokens.

Why does my decoded output look garbled?

If the original content was binary (an image, PDF, or non-UTF8 text), decoding the Base64 to a text string will produce garbled output. Base64 encoding is designed for binary-to-text, not text-to-text.

Does padding matter in Base64?

Yes — standard Base64 uses = or == padding to make the output length a multiple of 4. Some implementations (like JWT) strip padding; this tool handles both padded and unpadded input correctly.

Is my data sent anywhere when encoding or decoding?

No — all Base64 operations run in your browser using btoa() and atob() APIs. Your data never leaves your device.

Detailed Guide

Why You Encounter Base64 Everywhere

Base64 is one of those encoding formats that developers run into constantly without always understanding why it exists. The short answer: most networked systems were designed to handle text, not binary data. Base64 is the bridge — it represents binary byte sequences using a restricted set of 64 printable ASCII characters that survive transmission across text-only protocols without corruption.

It appears in JWT tokens, email attachments, CSS data URIs, HTTP Basic Auth headers, Kubernetes secrets, and dozens of API contexts. This tool encodes or decodes in both directions, immediately, in your browser.


How Base64 Encoding Works

The character set: A–Z (26) + a–z (26) + 0–9 (10) + + and / (2) = exactly 64 characters. All are printable ASCII that transmit safely through any text protocol.

The process:

  1. Every 3 bytes (24 bits) of input are grouped together
  2. Each group is split into four 6-bit values
  3. Each 6-bit value maps to one of the 64 characters
  4. = padding is added at the end if the input length isn't divisible by 3

Example: The word "Man" (3 bytes: 0x4D 0x61 0x6E) encodes to TWFu

Size trade-off: Base64 output is always approximately 33% larger than the input. Three input bytes always become four output characters.

In JavaScript:

// Encode (with Unicode support)
btoa(unescape(encodeURIComponent('Hello 👋')))

// Decode
decodeURIComponent(escape(atob('SGVsbG8g8J+Ruw==')))

The encodeURIComponent/escape wrappers handle non-ASCII Unicode that bare btoa()/atob() functions can't handle alone.


Base64 vs. Base64URL

Standard Base64Base64URL
CharactersA–Z, a–z, 0–9, +, /A–Z, a–z, 0–9, -, _
Padding= characters at endOften omitted
Safe in URLs❌ (+, / are special)
Used inEmail, file encodingJWTs, URL params

JWT tokens use Base64URL (no padding), which is why JWT segments don't end with =. Standard Base64 for files and general encoding does use padding.


Where You'll Use This

Decoding JWT payload claims: A JWT's middle segment (the payload) is Base64URL-encoded. Paste the segment here to see user ID, roles, expiry, and all claims as readable JSON. Then use JWT Decoder for a structured view.

HTTP Basic Auth debugging: Basic authentication sends credentials as Base64(username:password). Decode the Authorization: Basic ... header ...

Looking for a more detailed deep-dive and advanced tips?

Read Full Article on our Blog