Rated 4.8 out of 5 from 1,250+ users. Used by 16,000+ marketers, founders and small businesses.

Convert Image to a Data URL

Turn any image into a complete `data:` URL you can paste straight into a CSS `background-image`, an HTML `src`, or an SVG. Includes the MIME prefix, so it works as-is. Runs entirely in your browser.

Free preview · No signup · ~10 seconds

No signup required
Results in seconds
Free unlimited previews

Drop an image here

PNG, JPG, WebP or SVG — up to 30 MB

Runs entirely in your browser. Your image is never uploaded.

What a data URL is and what it costs

01

A data URL, not just the payload

This gives you the whole thing — data:image/png;base64, followed by the encoded bytes. That distinction matters: a bare Base64 string will not render if you drop it into a CSS url() or an img src, because the browser has no idea what it is looking at. The prefix is what makes it a usable URL.

02

Nothing leaves your machine

The encoding runs locally in your browser using the canvas API. Your file is never uploaded to a server just to be converted, which matters when the asset is an unreleased logo, a client mockup, or anything under NDA. Close the tab and there is nothing left behind.

03

One fewer network request

An inlined image is part of the stylesheet or document, so the browser never opens a second connection to fetch it. For a 1 KB icon that round trip often costs more than the bytes themselves, which is why small UI assets and email templates are the classic use case.

04

Where inlining stops paying off

Base64 inflates binary data by roughly a third, and an inlined image cannot be cached separately from the file that contains it. So a large hero image inlined into your CSS gets re-downloaded on every cache miss of that CSS. Inline the small and rarely-changing; host the rest.

05

What happens to each format

PNG, JPG, WebP, and SVG all work as input. The output is normalised to a PNG data URL, so transparency is preserved and the result is predictable across browsers. If you need the original format kept byte-for-byte, use a hosted file rather than an inline URL.

Data URI, raw Base64, or a hosted file?

Data URI

data:image/png;base64,…

  • Includes the MIME prefix, so it is a valid URL
  • Drops straight into CSS url() and img src
  • About 33% larger than the source file
Best for

Small icons, CSS backgrounds, HTML email, single-file demos

Not ideal for

Photos and any image reused across many pages

Raw Base64

iVBORw0KGgo…

  • Payload only — no prefix
  • Will not render if pasted into CSS as-is
  • Same 33% size overhead
Best for

JSON payloads, API request bodies, config files

Not ideal for

Anywhere a URL is expected

Hosted file

/images/logo.png

  • No encoding overhead at all
  • Cached independently and reused across pages
  • Costs one extra network request
Best for

Photos, shared assets, anything over a few KB

Not ideal for

Contexts where external requests are blocked

How to convert image to a data url

1

Drop in your image

Add a PNG, JPG, WebP, or SVG. The file is read locally by your browser and never sent anywhere.

2

Read the data URL

The complete `data:` URL appears in the result panel as soon as the image loads — prefix included, ready to use.

3

Copy or save it

Copy it straight into your CSS or HTML, or download it as a plain .txt file to keep for later.

What the data URL encoder looks like

The Image to Data URI tool with a brand logo loaded, showing the complete data:image/png;base64 URL in the result panel and a Copy button in the header
The result panel shows the complete URL — note it opens with `data:image/png;base64,`, which is the part that makes it usable in CSS. The header button copies the whole string.

Where data URLs make sense

CSS backgrounds

Inline a small icon or pattern into a `background-image` with no extra file.

HTML email

Some email builds require images inlined rather than linked from a CDN.

SVG and markup

Embed a raster image inside an SVG `<image>` or a single-file HTML document.

Prototypes and demos

Ship a self-contained page with no asset folder to keep in sync.

Bundled extensions

Browser extensions and userscripts often ship icons inline to avoid packaging files.

Or just ask

Describe the edit in your own words

Type what you want changed and the assistant does it on the canvas — each step lands as a layer you can reopen, so nothing it does is baked in.

Assistant
Ask or request a change…
Orbit
Original
Edits0

No edits yet.

Try it on your own image

Frequently Asked Questions

4.8/5 from 1,250+ users

Get a paste-ready data URL

Upload an image and copy the complete `data:` URL.