🔄

Free Base64 Encoder & Decoder

Encode plain text to Base64 or decode Base64 strings back to text — instantly.

← Back to all tools

Advertisement

Result will appear here...

Copied!

Advertisement

How to Encode or Decode Base64

1

Paste your input

Enter plain text to encode it, or paste a Base64 string to decode it back to readable text.

2

Click Encode or Decode

Click "Encode to Base64" to convert your text, or "Decode from Base64" to reverse a Base64 string.

3

Copy the result

Click "Copy Output" to copy the result to your clipboard and use it wherever you need.

Frequently Asked Questions

What is Base64?

Base64 is an encoding scheme that converts binary or text data into 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It is used to transmit binary data through text-only channels like email and to embed binary data in HTML, CSS, or JSON.

When do I need Base64 encoding?

Use Base64 when embedding images in HTML or CSS as data URIs (data:image/png;base64,...), sending binary data in JSON APIs, encoding HTTP Basic Auth credentials, or storing binary content in XML or text-based formats.

Is my data safe?

Yes. All encoding and decoding runs entirely in your browser using JavaScript. Your data is never sent to any server — completely private.

Is Base64 the same as encryption?

No. Base64 is encoding, not encryption. It is trivially reversible by anyone and provides zero security. Never use it to protect sensitive or private data — use AES or RSA encryption instead.

Why does Base64 output end with == signs?

Base64 encodes 3 bytes at a time into 4 characters. When the input length isn't divisible by 3, = or == padding characters are added to make the output length a multiple of 4.

What is the difference between Base64 and Base64url?

Base64url replaces + with - and / with _ and removes = padding. It is used in JWT tokens and URL parameters where standard Base64 characters would otherwise need to be percent-encoded.

How do I decode a JWT token payload?

A JWT has three dot-separated Base64url parts. Copy the middle part (the payload), paste it here, and click Decode to read the claims as JSON. Remember: JWT payloads are encoded, not encrypted — never put secrets in them.

Where Base64 is used in real systems

Email attachments (MIME)

Every email attachment is Base64-encoded. SMTP was designed for 7-bit ASCII text only — binary files (PDFs, images, ZIPs) get converted to Base64 so they survive transmission through old mail servers. This adds ~33% to file size but ensures compatibility.

Data URIs in HTML/CSS

<img src="data:image/png;base64,iVBORw0KGgo..."> embeds an image directly in HTML or CSS without a separate file. Useful for tiny icons (saves HTTP requests) and email templates (no external images that might be blocked). Don't use for large images — the 33% overhead and lack of caching hurt performance.

HTTP Basic Authentication

The Authorization: Basic dXNlcjpwYXNz header is just username:password Base64-encoded. NOT secure by itself — always pair with HTTPS. The encoding is for transport convenience, not protection.

JWT tokens

JSON Web Tokens have three Base64url-encoded parts: header.payload.signature. The header and payload are visible to anyone (decode them here to inspect claims) — only the signature provides tamper-proofing. Never store passwords or secrets in JWT payloads.

API keys and credentials in config

Many APIs send credentials as Base64-encoded strings (just encoding, not encryption — keep configs in environment variables or secret managers, not in repos). Use Base64 to convert binary credentials (like service-account JSON keys) into a single line for environment variables.

SSL/TLS certificates (PEM format)

The familiar -----BEGIN CERTIFICATE----- blocks contain Base64-encoded binary certificates wrapped in headers. The encoding makes certificates copyable, paste-able, and email-able without corruption.

Webhook signatures

Stripe, GitHub, Slack and other services sign webhook payloads with HMAC. The signature header is typically a hex or Base64 string. Decode and compare to verify the webhook actually came from the provider.

Understanding the Base64 character set

Base64 uses exactly 64 characters: A-Z (26), a-z (26), 0-9 (10), and + / (2). Plus = as padding. The name "Base64" refers to this 64-character alphabet — analogous to "base 10" (decimal) or "base 16" (hexadecimal). Each Base64 character represents 6 bits of data (2^6 = 64), so three 8-bit bytes (24 bits) encode into exactly four Base64 characters (24 bits).

When the input length isn't a multiple of 3 bytes, padding (= or ==) is added to round the output to a multiple of 4 characters. This is why you often see Base64 strings ending in = or ==. Some implementations (like JWT) strip the padding for compactness — that's still valid Base64, just without the visual length-marker.

Base64 vs other encodings

vs Hexadecimal

Hex uses 16 characters (0-9, A-F). It's twice as bulky as Base64 (2 hex chars per byte vs ~1.33 Base64 chars per byte). Use hex when human-readability matters more than size — for color codes, hashes, byte-level debugging.

vs URL encoding

URL encoding (%20 for space, etc.) handles special characters in URLs. Base64 converts binary to text. Different problems — but they overlap because Base64 output can contain + and / which need URL-encoding, so Base64url variant exists with - and _ instead.

vs Encryption

Base64 is encoding (reversible without keys). Encryption is irreversible without the correct key. Anyone can decode Base64 — never use it as "security through obscurity" for anything that matters.

vs Compression

Base64 makes data LARGER (~33% overhead). Compression (gzip, zstd) makes data smaller. Always compress before Base64-encoding if size matters.

Related Tools