Convert any file to a Base64 data URL, or decode a data URL back to a downloadable file โ€” all in your browser, no server, completely private.

๐Ÿ“

Drag & drop any file here, or click to browse

Images, SVG, fonts, JSON, PDF, audio, video โ€” any file type
File name โ€”
MIME type โ€”
Original size โ€”
Encoded size โ€”
Size increase โ€”
<div id="du-preview-wrap">
  <img id="du-preview-img" src="" alt="Preview">
  <div id="du-preview-label">Image preview</div>
</div>

<div class="du-output-block">
  <div class="du-output-header">
    <span class="du-output-title">Data URL (data:mime;base64,...)</span>
    <button class="du-copy-btn" data-target="du-out-dataurl">Copy</button>
  </div>
  <textarea id="du-out-dataurl" readonly spellcheck="false" placeholder="Data URL will appear here..."></textarea>
</div>

<div class="du-output-block">
  <div class="du-output-header">
    <span class="du-output-title">Base64 string only</span>
    <button class="du-copy-btn" data-target="du-out-b64">Copy</button>
  </div>
  <textarea id="du-out-b64" readonly spellcheck="false" placeholder="Base64 string will appear here..."></textarea>
</div>

<div class="du-output-block">
  <div class="du-output-header">
    <span class="du-output-title">CSS background-image</span>
    <button class="du-copy-btn" data-target="du-out-css">Copy</button>
  </div>
  <textarea id="du-out-css" readonly spellcheck="false" rows="2"></textarea>
</div>

<div class="du-output-block" id="du-img-src-block" style="display:none">
  <div class="du-output-header">
    <span class="du-output-title">HTML &lt;img&gt; src</span>
    <button class="du-copy-btn" data-target="du-out-html">Copy</button>
  </div>
  <textarea id="du-out-html" readonly spellcheck="false" rows="2"></textarea>
</div>

<div class="du-output-block" id="du-font-block" style="display:none">
  <div class="du-output-header">
    <span class="du-output-title">CSS @font-face src</span>
    <button class="du-copy-btn" data-target="du-out-font">Copy</button>
  </div>
  <textarea id="du-out-font" readonly spellcheck="false" rows="3"></textarea>
</div>

<div id="du-enc-actions">
  <button class="du-btn-secondary" id="du-reset-btn">Convert another file</button>
</div>
Detected MIME โ€”
Decoded size โ€”
Decoded image preview
Decoded image preview
โฌ‡ Download file

Common use cases

  • CSS background-image
  • HTML img src
  • Font embedding (@font-face)
  • SVG embedding
  • Email templates
  • JSON / API payloads
  • Offline web apps
  • Favicon embedding

How to use

File to Data URL

  1. Drag and drop any file onto the upload zone, or click to open the file picker.
  2. The tool reads the file using the browser FileReader API โ€” nothing is sent to any server.
  3. Copy the output format you need: full data URL, bare Base64, CSS background-image, HTML <img> tag, or CSS @font-face (for font files).

Data URL to File

  1. Switch to the Data URL โ†’ File tab.
  2. Paste your data:mime;base64,... string (or a bare Base64 string).
  3. Click Decode & Download to save the original file.

Output formats

FormatWhen to use
Data URLDirect value for src, href, or url()
Base64 stringAPIs, databases, JSON payloads
CSS background-imagePaste straight into a stylesheet
HTML <img> tagPaste straight into HTML
CSS @font-faceEmbed a web font without external requests

Why use data URLs?

Embedding a file as a Base64 data URI lets you ship a self-contained HTML file, email template, or CSS stylesheet with no external HTTP requests. Common scenarios:

  • SVG icons in CSS โ€” no extra network round-trip
  • Fonts in email โ€” some clients block external resources
  • Offline web apps โ€” embed assets directly in the app shell
  • API payloads โ€” pass binary data as JSON strings
  • Favicon embedding โ€” inline tiny icons without a separate file

The trade-off is roughly a ~33% size increase (every 3 bytes become 4 Base64 characters). Keep embedded assets small โ€” under ~50 KB is a good rule of thumb for production use.

Privacy

All conversion happens entirely in your browser using the FileReader and atob/btoa APIs. No file data is ever sent to a server.


Related tools: Base64 Encoder / Decoder ยท Image to Base64 ยท Base64 to Image