Base64 Decoder & Encoder
Decode and encode Base64 online for free. Real-time conversion with full UTF-8 and emoji support. 100% private — runs in your browser. No signup needed.
What is Base64?
Base64 is a binary-to-text encoding scheme defined by RFC 4648 that converts arbitrary binary data into a safe ASCII string representation using a 64-character alphabet. It is one of the most widely deployed encodings on the internet, underpinning everything from email attachments to JSON Web Tokens and TLS certificates.
"The Base 64 encoding is designed to represent arbitrary sequences of octets in a form that need not be humanly readable." — RFC 4648, Section 1
Base64 divides the input into groups of 3 bytes (24 bits), then splits those 24 bits into four 6-bit groups, each mapped to one of 64 printable characters: A-Z (0-25), a-z (26-51), 0-9 (52-61), + (62), and / (63). The = character pads the output when the input length is not a multiple of 3. Base64 encoding increases data size by approximately 33% (RFC 4648) — a deliberate trade-off to make binary data safe for text-only channels.
Base64 was originally designed to safely transmit binary data over channels that only support text, such as email (MIME) and early HTTP. Today it is ubiquitous: data URIs embed images in HTML, JWT tokens encode claims, PEM certificates wrap keys, and APIs transport binary payloads in JSON.
A Base64 encoder converts raw bytes to this safe ASCII representation, while a decoder reverses the process. All encoding and decoding in this tool runs entirely in your browser — your data is never uploaded to any server, making it safe to use with API keys, tokens, and other sensitive values.
Use this free online Base64 converter to decode Base64 to text or encode text to Base64 instantly in your browser.
Base64 is often used alongside other encoding and data tools. For example, you might need to format JSON data before Base64-encoding it for an API payload, URL-encode a Base64 string before placing it in a query parameter, or verify a file checksum with MD5 or SHA-256 after decoding a Base64-encoded download. New to Base64? Read our beginner-friendly Base64 guide. For advanced topics like MIME, data URLs, and performance optimization, see the advanced Base64 guide.
// Encode plain text to Base64
const encoded = btoa('Hello, World!');
console.log(encoded); // → 'SGVsbG8sIFdvcmxkIQ=='
// Decode Base64 back to text
const decoded = atob('SGVsbG8sIFdvcmxkIQ==');
console.log(decoded); // → 'Hello, World!'
// UTF-8 safe encode (handles Chinese, emoji, any Unicode)
function encodeBase64(str) {
const bytes = new TextEncoder().encode(str); // to UTF-8 bytes
return btoa(String.fromCharCode(...bytes));
}
console.log(encodeBase64('你好')); // → '5L2g5aW9' Key Features
Real-Time Conversion
Encode and decode instantly as you type — no buttons to click, results appear immediately in the other area.
Full UTF-8 Support
Correctly handles Chinese, Japanese, Korean, Arabic, emoji, and any Unicode text via TextEncoder/TextDecoder.
Bidirectional
Type in either area: plain text on the left encodes to Base64 on the right, Base64 on the right decodes to text on the left.
100% Browser-Based
All processing happens locally in your browser. Your data never leaves your device — no server uploads, no tracking.
Error Detection
Invalid Base64 input is detected immediately with a clear error message, so you know exactly what to fix.
One-Click Copy
Copy encoded or decoded results to your clipboard instantly with the Copy button on each side.
Examples
Plain Text
Hello, World!
SGVsbG8sIFdvcmxkIQ==
Simple ASCII text encoded to Base64
UTF-8 Text
你好世界 🌍
5L2g5aW95LiW55WMIPCfjI0=
Chinese characters and emoji with proper UTF-8 encoding
JSON Data
{"user":"alice","role":"admin"} eyJ1c2VyIjoiYWxpY2UiLCJyb2xlIjoiYWRtaW4ifQ==
Encode JSON payloads for embedding in URLs or headers
Multi-line Text
Line 1 Line 2 Line 3
TGluZSAxCkxpbmUgMgpMaW5lIDM=
Base64 preserves line breaks and whitespace
How to Use
- 1
Enter Text or Base64
Type or paste plain text in the left area to encode, or paste a Base64 string in the right area to decode. Conversion is instant and bidirectional.
- 2
See Real-Time Results
The other area updates automatically as you type. Any errors (like invalid Base64) are shown immediately.
- 3
Copy the Result
Click the Copy button on either side to copy the encoded or decoded result to your clipboard.
Common Use Cases
- Data URI Generation
- Encode images or files to Base64 for embedding directly in HTML or CSS as data URIs.
- JWT Debugging
- Decode Base64-encoded JWT token headers and payloads to inspect claims and expiration times.
- API Development
- Encode binary data for transmission in JSON APIs, or decode Base64 responses for inspection.
- Email Encoding
- Encode or decode MIME-encoded email content and attachments.
- Certificate Inspection
- Decode PEM-encoded certificates and keys to examine their binary content.
- Configuration Embedding
- Encode configuration data or secrets for safe embedding in environment variables or config files.
Technical Details
- RFC 4648 Compliant
- Implements standard Base64 encoding as defined in RFC 4648, using the A-Z, a-z, 0-9, +, / alphabet with = padding.
- UTF-8 Via TextEncoder
- Uses the Web API TextEncoder to convert Unicode strings to UTF-8 bytes before encoding, ensuring correct handling of all scripts and emoji.
- Browser-Based Processing
- All encoding uses native btoa()/atob() with TextEncoder/TextDecoder — no external libraries, no server calls.
Best Practices
- Don't Use Base64 for Security
- Base64 is encoding, not encryption. Never use it to 'protect' passwords, tokens, or sensitive data — always use proper encryption.
- Watch the Size Increase
- Base64 adds ~33% overhead. For large files, consider binary transfer instead of Base64 encoding.
- Use UTF-8 Encoding
- Always encode text to UTF-8 bytes before Base64 encoding to ensure non-ASCII characters (Chinese, emoji) are handled correctly.
Frequently Asked Questions
What is Base64 encoding?
Is my data safe when using this tool?
How does this tool handle non-ASCII characters like Chinese or emoji?
Is Base64 encryption?
Where is Base64 commonly used?
What is the difference between Base64 and URL-safe Base64?
Why does Base64 increase data size?
How do I encode a file to Base64?
Can I use Base64 in HTML and CSS?
What is the maximum input size?
What characters are in the Base64 alphabet?
I need to embed a small image in my HTML email template — should I use Base64 data URIs or host the image externally?
Why does my Base64 encoded string have + and / characters that break my URL parameters?
I'm trying to decode a JWT token — how does Base64URL decoding work and how is it different from standard Base64?
Related Tools
View all tools →JSON Formatter & Validator
Encoding & Formatting
Format, validate and beautify JSON instantly in your browser. Free online tool with syntax validation, error detection, minify and one-click copy. 100% private.
JSON to YAML Converter
Encoding & Formatting
Paste JSON, get YAML instantly. Live conversion in your browser. K8s/Compose-ready, 2/4-space indent, smart quoting. 100% private, no upload.
URL Encoder & Decoder with Built-in URL Parser
Encoding & Formatting
Decode or encode URLs in real time with built-in URL parser. Dual mode: encodeURI & encodeURIComponent. 100% private, no data sent to any server.
YAML to JSON Converter
Encoding & Formatting
Paste YAML, get JSON instantly. Live conversion in your browser. K8s manifests, OpenAPI specs, helm values supported. 100% private, no upload.
Number Base Converter — Binary, Hex, Decimal & Octal
Conversion Tools
Convert between binary, hex, decimal, octal and any base (2-36) instantly. Free, private — all processing in your browser.
Compress Images Online — JPEG, PNG & WebP
Conversion Tools
Compress JPEG, PNG & WebP up to 80% smaller — in your browser, no upload. Batch 20 images, adjust quality, compare before & after. Free & private.