Image to Base64 Data URI

Turn any image into a base64 data URI for HTML, CSS or Markdown.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

Turn an image into a base64 data URI without uploading it

A data URI lets you embed an image directly inside your HTML, CSS or Markdown instead of linking to a separate file — handy for tiny icons, email templates, self-contained pages and offline demos. This tool reads your image and produces a data:image/...;base64,... string, with optional ready-to-paste HTML <img> or CSS background-image wrappers.

How it works

The browser’s FileReader.readAsDataURL reads the original file bytes and encodes them as base64 without re-compressing, prefixing the MIME type detected from the file. The result is a single string of the form:

data:image/png;base64,iVBORw0KGgoAAAANS...

You can then copy it raw, or wrapped as <img src="..."> or background-image: url(...). Because base64 uses 4 characters for every 3 bytes, the encoded string is about 33% larger than the source file.

Example

SourceOutput
icon.png (1.2 KB)data:image/png;base64,... (~1.6 KB string)
HTML wrapper<img src="data:image/png;base64,...">
CSS wrapperbackground-image: url("data:image/png;base64,...")

The image is read locally with your browser’s FileReader, so it is never uploaded, stored, or seen by anyone. Data URIs are best for small assets rather than large photos.

Ad placeholder (rectangle)