Free tool

Image to data URI

Drop images, get base64 strings you can paste into an img tag, a CSS background or a favicon — so your single-file HTML app carries its pictures inside it and works offline with no folder to zip.

Convert images

PNG, JPG, WebP, GIF and SVG. Files are read in your browser; nothing is sent anywhere.

Drop images here, or click to choose Several at once is fine

What a data URI is

A data URI is an image (or any file) written out as text: data:image/png;base64,iVBORw0…. Put that string where a URL would go — the src of an <img>, a CSS url(), a favicon link — and the browser decodes it in place. No request, no file, no path. For a single-file HTML app that is exactly what you want: the page and its pictures are one document, so there is nothing to zip and nothing that can be missing when the APK is built.

When to embed, and when to keep files

Embed as data URIKeep as files in a ZIP
Icons, logos, small illustrationsYes — a few KB each, no path to breakFine too
Photos, backgrounds, sprite sheetsOnly if small; base64 is ~33% bigger and blocks parsingYes — cached and decoded separately
Many images (a gallery)No — the HTML becomes megabytes of textYes
SVGYes — it is already text; often smaller than PNGFine

The rule of thumb this tool applies: it warns once the embedded total passes about 1.5 MB. The free tier bundles up to 5 MB of source content, so there is room, but a page that starts with a megabyte of base64 opens noticeably slower than one that loads image files from the bundle.

Resizing and re-encoding

Images that will only ever be shown on a phone rarely need to be wider than about 1080 pixels, and a 4000px photo from a camera embedded at full size is the most common cause of a bloated single-file app. Set a maximum width and the image is scaled down on a canvas before encoding. Re-encoding as WebP typically halves the size of a JPEG at the same visible quality; every Android version that can install a modern APK can display it. Keep PNG for anything with transparency or sharp edges — WebP handles transparency too, but a PNG of an icon is often already small.

Frequently asked questions

Are the images uploaded anywhere?

No. They are read with the browser's FileReader, optionally drawn on a canvas to resize or re-encode, and turned into text locally. The page makes no network requests with your files.

How much bigger is base64 than the original file?

About a third — every 3 bytes become 4 characters. A 30 KB PNG becomes roughly 40 KB of text. Re-encoding as WebP usually more than pays that back for photographs.

Can I use a data URI as the app icon in the builder?

No — the builder wants an image file for the launcher icon because it generates several sizes from it. Data URIs are for images inside your page. Use the Square Icon Padder to prepare the icon file.

Why does my animated GIF stop animating after conversion?

Re-encoding draws one frame on a canvas. Keep the original format (the default) and the GIF is embedded as-is with its animation intact.

Does this work for fonts or audio too?

The same idea works for any file, but this tool is for images. Fonts are better kept as files in a ZIP; audio should always be a file — a base64 MP3 in HTML is enormous and slow to parse.

Read next

Related tools

Your HTML, installed on a phone today

Upload the file or ZIP, pick a name and an icon, and download a signed Android APK in minutes. Free to start — no Android Studio, no code changes, no card.

Convert HTML to APK — free