Skip to main content
100% Client-Side • Zero Data Sent to Servers
developerRFC 4648 UTF-8 & Base64URLBrowser Native APIOffline Ready

Base64 Encoder / Decoder

Encode and decode UTF-8 text to and from standard or URL-safe Base64 without mangling multi-byte Unicode characters.

22 chars • 24 B
Base64 Output
< 2msExecution Speed
RAM OnlyMemory Sandbox
UTF-8Encoding Spec
0 BytesNetwork Transit
Section 1.0 • Quickstart Guide

How to Use Base64 Encoder / Decoder

Follow these three steps to process, validate, and export your data locally inside your browser with zero server latency:

1Step 01

Select Encode (Plain Text → Base64) or Decode (Base64 → Plain Text).

2Step 02

Optionally toggle URL-safe mode (`-` and `_` instead of `+` and `/`).

3Step 03

Enter your text and copy or download the converted result.

Section 2.0 • Technical Deep-Dive & Architecture

How RFC 4648 Base64 Serialization Works & Solving the Browser Unicode Bug

Base64 (standardized in IETF RFC 4648) is a binary-to-text encoding scheme that translates arbitrary binary octets into a safe 64-character ASCII alphabet. It operates by grouping every three 8-bit bytes (24 bits total) into four 6-bit chunks, mapping each 6-bit value (0–63) to an ASCII character (A–Z, a–z, 0–9, +, /). When the input byte length is not divisible by 3, one or two = padding characters are appended.

In web browsers, the built-in window.btoa() and window.atob() functions were designed in the 1990s for Latin-1 (ISO-8859-1) strings and throw an InvalidCharacterError whenever any character exceeds code point 0xFF (such as emojis or CJK scripts). Our Base64 engine converts strings into a UTF-8 byte stream via TextEncoder before encoding, and reconstructs UTF-8 characters via TextDecoder upon decoding.

Base64 Is Encoding, Not Encryption

Never use Base64 alone to hide passwords, API keys, or PII. Anyone can decode a Base64 string instantaneously without a key. Even HTTP Basic Authentication (Authorization: Basic <base64>) is only safe when transmitted over an encrypted TLS/HTTPS connection.

Section 3.0 • Specifications & Reference Matrix

Standard Base64 vs Base64URL (RFC 4648) Comparison

Understand when to use standard Base64 versus URL-safe Base64URL across modern web protocols:

AttributeStandard Base64 (RFC 4648 §4)Base64URL (RFC 4648 §5)
62nd Character (Index 62)+ (Plus sign)- (Hyphen / Minus)
63rd Character (Index 63)/ (Forward slash)_ (Underscore)
Padding Character (=)Mandatory (= or ==)Omitted in URLs & JWTs
Safe in URLs & Filenames?No (+, /, and = require % escaping)Yes (100% unreserved URI characters)
Primary Use CasesData URIs, MIME email, PEM certsJSON Web Tokens (JWT), OAuth 2.0, URL IDs
Section 4.0 • Engineering Best Practices & Pitfalls

Base64 Engineering Use Cases & Performance Guidelines

Apply Base64 effectively in API authentication, JWT debugging, and asset delivery:

1. Inspecting JSON Web Tokens (JWT)

Auth Debugging

A JWT consists of Header.Payload.Signature encoded in Base64URL. Enable the "URL-Safe Base64URL" checkbox to decode JWT segments cleanly without padding errors.

2. Constructing HTTP Basic Auth Headers

REST APIs

HTTP Basic Auth encodes "username:password" in Standard Base64. Ensure there is no trailing newline at the end of your credentials before encoding.

Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

3. Mind the 33% Bandwidth Overhead

Web Performance

Base64 increases payload byte size by roughly 33%. Avoid Base64-encoding multi-megabyte files inside JSON bodies; use multipart/form-data or binary streams instead.

4. Handling Whitespace in PEM & MIME Blocks

Parser Resilience

MIME Base64 wraps lines every 76 characters. Our decoder automatically strips whitespace and line breaks before reconstructing your UTF-8 payload.

Practical Examples & Input/Output Reference

Encoding UTF-8 text with emojis and accents

Safely encoding multi-byte UTF-8 characters into Base64.

Sample Input

Hello, Café 🚀

Expected Output

SGVsbG8sIENhZsOpIPCfmoA=

Frequently Asked Questions

Why does standard browser `btoa()` fail on emojis or non-Latin characters?

Built-in `btoa()` only accepts Latin1 single-byte characters. Our tool converts strings to UTF-8 bytes via `TextEncoder` first so all Unicode text encodes accurately.