Oh MyUtils

Base64 Encode & Decode - Text and File Encoding Online

Encode text or files to Base64 and decode Base64 strings instantly in your browser. Supports image-to-data-URI conversion — no data uploaded.

Mode
Encoding
Input
Output

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /). It's designed to carry data stored in binary formats across channels that only reliably support text content. The encoded output is approximately 33% larger than the original data.

Why use Base64 encoding?

Base64 is commonly used for: embedding images in HTML/CSS via Data URIs, transmitting binary data in JSON/XML APIs, encoding email attachments (MIME), storing binary data in text-based formats, and creating URL-safe tokens like JWTs. It ensures data integrity when passing through text-only systems.

How does Base64 encoding work?

Base64 works by taking 3 bytes (24 bits) of binary data and splitting them into 4 groups of 6 bits each. Each 6-bit group maps to one of 64 characters. If the input isn't divisible by 3, padding characters (=) are added. For example, 'Hi' (2 bytes) becomes 'SGk=' with one padding character.

Code Examples

// Encode
const encoded = btoa('Hello, World!');
console.log(encoded); // "SGVsbG8sIFdvcmxkIQ=="

// Decode
const decoded = atob(encoded);
console.log(decoded); // "Hello, World!"

Related Tools