Free Base64 Encoder / Decoder

Encode any text to Base64 or decode Base64 strings back to readable text. Handles UTF-8 characters properly. Instant, free, and completely client-side.

Output
Input Length
Output Length

What Is Base64 Encoding?

Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters (A-Z, a-z, 0-9, +, /). It is not encryption — Base64 does not provide security, only a way to safely transmit binary data through text-only channels. Anyone can decode a Base64 string without a key.

Base64 is widely used in web development for embedding images in CSS/HTML (data URIs), encoding email attachments (MIME), transmitting binary data in JSON or XML, storing complex data in cookies or URL parameters, and basic HTTP authentication headers.

How Base64 Works

Base64 encoding takes every 3 bytes (24 bits) of input and splits them into 4 groups of 6 bits each. Each 6-bit group maps to one of 64 characters. This means Base64 output is always approximately 33% larger than the input. The padding character (=) is added when the input length is not divisible by 3.

This tool handles UTF-8 text properly using the TextEncoder and TextDecoder APIs, ensuring that non-ASCII characters (accented letters, emojis, CJK characters) are encoded and decoded correctly rather than producing garbled output.

More Security Tools

Frequently Asked Questions

Is Base64 encryption?
No. Base64 is an encoding scheme, not encryption. It provides no security whatsoever — anyone can decode Base64 without a key or password. It is designed for data transport, not data protection. Never use Base64 to protect sensitive information.
Why does Base64 output look longer than the input?
Base64 converts every 3 bytes of input into 4 characters of output, resulting in approximately 33% size increase. This is the tradeoff for being able to represent any binary data using only safe ASCII characters.
What characters are valid in Base64?
Standard Base64 uses 64 characters: uppercase A-Z (26), lowercase a-z (26), digits 0-9 (10), plus (+), and forward slash (/). The equals sign (=) is used for padding. URL-safe Base64 replaces + with - and / with _ to avoid issues in URLs.
Why does this tool handle UTF-8 specially?
JavaScript's built-in btoa() function only works with characters in the Latin-1 range (code points 0-255). Characters like emojis or non-Latin scripts will cause an error. This tool uses TextEncoder to convert UTF-8 text to bytes first, then encodes those bytes to Base64, ensuring all characters work correctly.
When should I use Base64 encoding?
Use Base64 when you need to embed binary data in text formats (like images in HTML/CSS), include binary data in JSON payloads, encode data for URL parameters or cookies, or transmit data through systems that only support text. Avoid Base64 for large files, as the 33% size increase adds unnecessary overhead.