Quick Tools Logo Quick Tools

Base64 Encoder / Decoder

Encode and decode Base64 strings instantly.

What is Base64?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters. It's commonly used for embedding images in HTML/CSS, sending attachments in emails, and storing complex data in JSON.

📘 How It Works

1

Binary to Text Conversion

Base64 represents 6 bits with 1 character. 3 bytes (24 bits) become 4 Base64 characters. Padding (=) fills incomplete groups.

2

Encoding Process

Text → UTF-8 bytes → 6-bit groups → Base64 character lookup. Uses A-Z, a-z, 0-9, +, / (64 characters).

3

Decoding Process

Reverse the encoding: Base64 characters → 6-bit values → bytes → original data.

4

Unicode Handling

UTF-8 encoding preserves non-ASCII characters. International text encodes/decodes correctly.

5

Browser Implementation

Uses JavaScript's btoa()/atob() with UTF-8 wrapper for full Unicode support.

💡 Common Use Cases

Data URIs

Embed images directly in HTML/CSS: data:image/png;base64,... Reduces HTTP requests.

API Authentication

HTTP Basic Auth uses Base64 for credentials. Format: Authorization: Basic <base64>.

Email Attachments

MIME encoding uses Base64 for binary attachments. Ensures safe transmission through text-based email systems.

JSON Storage

Store binary data in JSON by Base64 encoding. Common for images, files, or encrypted data.

URL-Safe Data

Encode complex data for URL parameters. Use URL-safe Base64 variant if needed.

Configuration Files

Encode secrets or binary configuration in text-based config files. Often combined with encryption.

Related Web / Dev Utilities Tools