Illustration of a file converting into a Base64 text string and back, with bidirectional arrows

Base64 ↔ File Converter

File → Base64/Data URL, and Base64 → File, both entirely in your browser — nothing is uploaded to run either conversion. Any file type works, not just images.

Also doubles as a File → Data URL tool for developers: the Data URL below is the exact string browsers accept anywhere a URL is expected — <img src>, CSS background-image, a JS variable — so a small file can ship inline with your HTML/CSS instead of as a separate file request. Ready-made snippets are below the output.

Drag & drop a file here, or


ℹ️ How this works
  • File → Base64/Data URL uses FileReader.readAsDataURL() — the file never leaves your browser to be converted. Works with any file type; an image preview shows up automatically when the file happens to be one.
  • Base64 → File decodes the string locally and offers it as a download; if you paste raw Base64 without a data:...;base64, prefix, the type is guessed from the decoded bytes' first few bytes (images, PDF, ZIP, GZIP) or you can set an output filename yourself to control the extension.
  • A Base64 string is about 33% larger than the original binary file — expected, not a bug, and the trade-off for being safely embeddable as plain text.
  • The HTML/CSS/JS snippets are just the Data URL dropped into the three places it's most commonly pasted — copy whichever matches what you're working on. The CSS background-image snippet only makes sense for images, so it's skipped for other file types.
  • A Data URL over roughly 10KB gets a size warning: it's still valid, but at that point it usually bloats the file it's embedded in more than it saves by avoiding a separate request — small icons, logos, and other small files are the sweet spot for this technique.
  • A single copy of an uploaded file (File → Base64 direction only) is sent to an internal log for abuse monitoring, capped at 10 files per hour per visitor. Pasting Base64 text never uploads anything.