Free Base64 Encoder & Decoder

Encode any text to Base64 or decode any Base64 string instantly — browser-based, nothing uploaded, no sign-up.

⚠️ Invalid Base64 — check your input for invalid characters.
About this tool

What is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that converts data into a string of 64 printable ASCII characters. It solves a fundamental compatibility problem — many systems like email, JSON APIs, and HTTP headers are designed for plain text, but images, files, and certificates are binary. Base64 bridges that gap.

💡 One-line definition

Base64 takes any data and turns it into safe, printable text — so it can travel through text-only systems without corruption.

Use cases

When is Base64 Used?

📧 Email Attachments

MIME encoding uses Base64 to embed binary files in plain-text email messages.

🖼️ Inline Images

Embed images directly in HTML/CSS using data:image/png;base64,...

🔐 HTTP Basic Auth

Credentials are Base64-encoded in the Authorization header for Basic authentication.

🪙 JWT Tokens

JSON Web Tokens use Base64URL to encode their header and payload sections.

🔑 API Keys

Many APIs encode keys and secrets as Base64 strings for HTTP header transmission.

📜 SSL Certificates

PEM format certificates are Base64-encoded DER files with standard header/footer lines.

How it works

How Base64 Encoding Works — Step by Step

Base64 encodes data in groups of 3 bytes (24 bits), converting each group into 4 characters. Here's how "Man" is encoded:

1
Input text
M    a    n
↓ Convert to ASCII decimal values
2
ASCII bytes
77    97    110
↓ Convert to 24-bit binary
3
Binary (24 bits)
01001101   01100001   01101110
↓ Split into 4 groups of 6 bits → map to Base64 alphabet
4
Base64 output
T W F u

Every 3 bytes of input → 4 Base64 characters. This 4:3 ratio means Base64 data is always ~33% larger than the original.

The = padding

If the input is not a multiple of 3 bytes, = padding is added. One remaining byte → 2 chars + ==. Two remaining bytes → 3 chars + =.

Size overhead

How Much Does Base64 Increase File Size?

Base64 always increases data size by approximately 33%:

Original dataOriginal sizeBase64 sizeIncrease
Short API token30 bytes~40 chars+33%
Small image10 KB~13.3 KB+33%
Profile photo100 KB~133 KB+33%
PDF document1 MB~1.33 MB+33%
⚠️ Performance tip

Only inline small images as Base64 data URIs. Large images increase HTML/CSS size and slow page load — serve them as separate files.

Security

Base64 is NOT Encryption

This is the most important thing to understand about Base64:

🚨 Security warning

Base64 provides zero security. Anyone can decode it instantly with no key or password. Never use Base64 to protect passwords, tokens, or sensitive data. Use proper encryption (AES, RSA) or hashing (bcrypt, Argon2) instead.

In code

Base64 in Code — 4 Languages

JavaScript

// Encode const encoded = btoa("Hello, World!"); // → SGVsbG8sIFdvcmxkIQ== // Decode const decoded = atob("SGVsbG8sIFdvcmxkIQ=="); // → Hello, World!

Python

import base64 encoded = base64.b64encode(b"Hello, World!").decode("utf-8") decoded = base64.b64decode("SGVsbG8sIFdvcmxkIQ==").decode("utf-8")

Node.js

const encoded = Buffer.from("Hello, World!").toString("base64"); const decoded = Buffer.from("SGVsbG8sIFdvcmxkIQ==", "base64").toString("utf-8");

PHP

$encoded = base64_encode("Hello, World!"); $decoded = base64_decode("SGVsbG8sIFdvcmxkIQ==");
FAQ

Frequently Asked Questions

Base64 is a binary-to-text encoding scheme that converts binary data into 64 printable ASCII characters. It is used to safely transmit binary data through text-only systems like email and JSON APIs.
No. Base64 is encoding, not encryption. It provides zero security. Anyone can decode a Base64 string instantly without a key. Use AES, RSA, or bcrypt for actual security.
Base64 encodes in groups of 3 bytes. If the input isn't a multiple of 3 bytes, = padding characters are added. One = means 1 padding byte; == means 2 padding bytes.
Base64 increases data size by approximately 33%. Every 3 bytes become 4 characters — a 4:3 ratio. A 100KB image becomes approximately 133KB when Base64-encoded.
Base64URL is a URL-safe variant that replaces + with - and / with _ to avoid conflicts in URLs. It also omits = padding. Used in JWT tokens and web contexts where standard Base64 chars would need URL encoding.
Yes. All encoding and decoding happens locally in your browser using JavaScript. Your text is never uploaded to any server — safe for API keys, tokens, and confidential content.
Related tools

Related Free Tools