Skip to content

Base64 file encoder

Two-way converter: file → base64 (with or without data:URL prefix), base64 → binary file with any name.

A two-way converter for embedding binary files in text containers: HTML, CSS, JSON API payloads, email, debug logs, test fixtures. In encode mode it streams the file through FileReader.readAsDataURL (this is native — it does not hit a stack overflow on large files the way a manual btoa(String.fromCharCode…) on a Uint8Array would) and shows the base64 string in a textarea with three actions: “Copy” (via the Clipboard API), “Download .b64” (as a plain-text file next to the source name), and “Add data:URL prefix” (format data:image/png;base64,…, ready to paste straight into CSS background-image or an img src). In decode mode it accepts pasted base64 text (whitespace and newlines tolerated — typical when copying from logs), strips a data: prefix if present, infers MIME from that prefix, decodes through atob into a Uint8Array, and hands you a Blob with the filename you choose. Size is limited only by how much the browser can hold in memory (tens of megabytes work fine on a typical laptop). Processing happens in the browser, the file never leaves your device.