Base64 Encoder
Encode text or a file to Base64. Supports URL-safe output and can produce a complete data URI.
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.