Base64 Encoder
Paste text or drop in a file to encode it as Base64, in standard or URL-safe form, or as a complete data URI with the right MIME type. Unicode such as 'café' encodes correctly via UTF-8, and the output is about 33% larger than the input. Base64 is an encoding, not encryption. Nothing is uploaded.
Updated
How to use the Base64 Encoder
- 1Paste text, or drop in a file.
- 2Choose standard or URL-safe encoding.
- 3For files, optionally produce a full data URI with the correct MIME type.
- 4Copy the result or download it.
How it works
Base64 represents binary data using 64 printable ASCII characters, taking three bytes at a time and rewriting them as four characters. The cost is size: output is always about 33% larger than the input. The benefit is that the data survives transport through systems that only handle text — email bodies, JSON strings, HTTP headers, URLs.
Unicode needs care. The browser's btoa() only accepts bytes, so passing it a string with an accented character or an emoji throws an error. Text here is encoded to UTF-8 bytes first, which is why 'café' and '日本語' encode correctly rather than failing.
URL-safe encoding swaps + and / for - and _, because the standard characters have their own meaning in a URL and would otherwise need percent-encoding on top. Padding is usually dropped in this variant.
Base64 is an encoding, not encryption. Anyone can decode it instantly. It hides nothing.
Everything runs in this page. Nothing you paste is transmitted, logged or stored, which is what makes it safe to drop a production payload in here while you are debugging.
Tips and common mistakes
- Never use Base64 to hide secrets; anyone can decode it instantly.
- Embed only small images as data URIs; large ones bloat HTML and CSS and cannot be cached separately.
- Choose URL-safe encoding for values that go into URLs, cookies or tokens.
- Expect the output to be about a third larger than the input.