Skip to main content

Base64 Encoder / Decoder

Encode text to Base64 or decode Base64 to text. Standard and URL-safe variants.

Your data never leaves your browser

About Base64 Encoding

Base64 is a binary-to-text encoding defined in RFC 4648 that represents arbitrary bytes using 64 printable ASCII characters: A-Z, a-z, 0-9, +, and /. Every three input bytes map to four output characters, with = padding when the input length is not a multiple of three. The encoding was designed to transmit binary data over channels that only reliably support text, such as email (MIME), XML, and JSON.

The URL-safe variant (also defined in RFC 4648, section 5) replaces + with - and / with _, avoiding characters that have special meaning in URLs and filenames. This variant is used extensively in JWTs, data URIs, and web APIs. Base64 increases data size by approximately 33%, so it is not compression; it is purely a representation change.

This tool encodes and decodes in your browser using the built-in btoa/atob functions (with TextEncoder for full Unicode support). Toggle between standard and URL-safe variants. No data is transmitted to any server.

Frequently Asked Questions

What is Base64 encoding?

Base64 is a binary-to-text encoding scheme defined in RFC 4648. It represents arbitrary binary data using 64 printable ASCII characters (A-Z, a-z, 0-9, +, /), plus = for padding. Every three bytes of input produce four characters of output, making it safe for channels that only handle text, such as email bodies, JSON payloads, and XML documents.

Why does Base64 increase data size by ~33%?

Three input bytes (24 bits) are split into four 6-bit groups, each mapped to one ASCII character. Since four output bytes represent three input bytes, the ratio is 4/3, which is a 33.3% increase. Padding characters (=) can add one or two extra bytes when the input length is not a multiple of three.

What is URL-safe Base64?

URL-safe Base64, defined in RFC 4648 section 5, replaces + with - and / with _, and omits the trailing = padding. This avoids characters that have special meaning in URLs and filenames. It is widely used in JSON Web Tokens (JWTs), data URIs, and web API parameters.

Can Base64 encode binary files?

Yes. Base64 can encode any sequence of bytes, including images, PDFs, and executables. This tool is designed for text-to-Base64 conversion. For binary files, the encoding concept is the same, but you would typically use a programming language's Base64 library to handle raw byte streams.

Is Base64 encryption?

No. Base64 is an encoding, not encryption. It provides no confidentiality; anyone can decode a Base64 string back to the original data without a key. It is purely a representation change designed for safe transport over text-only channels. Never use Base64 as a security measure.