Skip to content
Free tool · runs in your browser

HTML & image to data URL

Turn HTML text, an image, a font or any small file into a data: URL — a link that carries the file inside itself. Ideal for making single-file pages with no broken images.

What a data URL is

A data URL puts the contents of a file directly into the address: data:image/png;base64,iVBORw0…. Wherever a normal URL is accepted — an <img src>, a CSS url(), a font — a data URL works too, with no second request and no separate file to forget. The cost is size: Base64 makes binary data about 33% bigger, and the data cannot be cached separately.

The main use: single-file HTML pages

The most common reason a shared HTML page shows broken images is that the images lived next to the file on someone's computer. Converting small images, icons and logos to data URLs and pasting them into the HTML makes the page completely self-contained — it can be emailed, uploaded as one file, or pasted into an HTML code to URL converter with nothing missing. Keep it for small assets: a page full of multi-megabyte photos as data URLs gets slow; upload a folder with ZIP to URL instead.

Can a data:text/html URL replace hosting?

Not any more. A data:text/html URL used to open as a page when pasted into the address bar, which made it a cheap way to "share HTML as a URL". Chrome, Firefox and Safari now block top-level navigation to data URLs because phishers abused them, so a link like that does nothing when clicked. It still works inside an <iframe src> on a page you control — which is what the HTML snippet above produces — but to give someone a clickable link, the page has to be hosted. That is what the converter is for.

Size guide

  • Icons and logos under ~10 KB: always fine as data URLs.
  • Images 10–200 KB: fine for a handful; compress to WebP first.
  • Anything over ~1 MB: host the file and link to it.

Related guides

Frequently asked questions

How do I convert an image to a data URL?

Drop it on the box above and copy the result, or the ready-made <img> snippet.

Why does my data:text/html link not open?

Modern browsers block opening data URLs as top-level pages. Host the HTML and share a normal https:// URL instead.

Are data URLs bad for performance?

Small ones help (no extra request). Large ones hurt: they are 33% bigger and are not cached separately.

Is the file uploaded?

No. It is encoded by your browser with the FileReader API.

More free tools

Paste HTML. Get a URL.

Code, an .html file, a ZIP or a whole folder becomes a live HTTPS URL with your own address, an optional password and a QR code. Free to start with Google sign-in; paid plans keep URLs online for good.

Convert HTML to URL