Tool

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 strings back to plain text. Full UTF-8 support. All processing happens in your browser.

Base64 Output
Output will appear here

Uses btoa/atob with UTF-8 support. All processing is client-side.

How to Use This Tool

To encode: select the "Encode" tab, type or paste your plaintext into the input area, and the Base64-encoded output appears instantly in the result field.

To decode: select the "Decode" tab, paste your Base64 string into the input area, and the decoded plaintext appears in the result. If the input contains invalid Base64 characters, an error will be shown.

This tool handles full UTF-8 input, including emoji, international characters, and multi-byte sequences. Use URL-safe Base64 (replaces + with - and / with _) when embedding Base64 in URLs or HTTP headers.

Code Examples

// Encode to Base64
const text = 'Hello, World! 🌍';
const encoded = Buffer.from(text, 'utf8').toString('base64');
console.log(encoded); // SGVsbG8sIFdvcmxkISDwn4yN

// Decode from Base64
const decoded = Buffer.from(encoded, 'base64').toString('utf8');
console.log(decoded); // Hello, World! 🌍

// URL-safe Base64 (for JWT, URLs)
const urlSafe = Buffer.from(text).toString('base64url');
console.log(urlSafe); // no +/= chars

Frequently Asked Questions

What is Base64 encoding used for?

Base64 encodes binary data as ASCII text, making it safe to transmit over text-based protocols like email (MIME attachments), HTTP headers, or JSON fields. Common uses include encoding binary files for data URLs, encoding credentials in HTTP Basic Auth headers, and storing binary data in JSON or XML. JWT tokens use Base64URL encoding for their header and payload.

Does Base64 encrypt my data?

No. Base64 is encoding, not encryption. It transforms data into a different representation — it does not hide or protect the content. Anyone can decode a Base64 string instantly without any key. Never use Base64 as a security measure. Use proper encryption (AES-256) if you need to protect data.

What is the difference between standard Base64 and URL-safe Base64?

Standard Base64 uses + and / characters and = padding, which have special meanings in URLs. URL-safe Base64 replaces + with - and / with _, and often omits the = padding. JWT tokens use URL-safe Base64 (Base64URL) for this reason. Use URL-safe when the encoded string will appear in a URL, query parameter, or HTTP header.

Why is my Base64 output longer than my input?

Base64 encodes every 3 bytes of input as 4 ASCII characters, resulting in approximately 33% size overhead. A 100-byte binary input produces roughly 136 characters of Base64 output. This is an unavoidable trade-off of making binary data text-safe.

Related Tools