Tools

Home
Base64 Encode/DecodeString to HexHash GeneratorUTF-8 Encode/DecodeURL Encode/Decode

Convert Png To Data Uri Online

Convert Png To Data Uri online. All processing happens in your browser.

Your files never leave your browser
No image loaded
INPUT
🖼

Drop image here or click to upload

Max 50MB • 100% Private

OUTPUT
Ready

Drop a PNG and get back a data:image/png;base64,... string ready to paste into HTML, CSS, or an email template. Best for tiny icons under 10 KB — anything bigger bloats your file faster than a normal <img> tag would. And everything runs in your browser. Nothing gets uploaded.

How It Works

Drop PNG File
→
Base64 Encode
→
Copy Data URI

Your browser reads the PNG as binary data using the FileReader API, then converts those bytes into a Base64 string. The tool prepends the MIME header data:image/png;base64, so the result is a valid data URI. The whole process takes milliseconds for typical images — no network request involved.

Examples

Embedding a Favicon in HTML

You want a self-contained HTML file with no external dependencies — useful for single-file demos or email signatures.

INPUT
favicon.png (16×16, 1.2 KB)
OUTPUT
data:image/png;base64,iVBORw0KGgo... (~1.6 KB string)

CSS Background for a Button Icon

Replacing an external sprite sheet with inline data URIs to cut HTTP requests on a landing page.

INPUT
arrow-right.png (24×24, 0.4 KB)
OUTPUT
background-image: url(data:image/png;base64,iVBOR...);

Inlining a Logo into an Email Template

Email clients block external images by default. Embedding the logo as a data URI means it shows up without the recipient clicking "load images" — though some clients still strip it, so test first.

INPUT
company-logo.png (200×50, 8.3 KB)
OUTPUT
data:image/png;base64,iVBORw0KGgo... (~11 KB string)

Who Uses This

👨‍💻 Front-End Developers

Inline small icons and UI graphics to reduce HTTP requests on performance-critical pages.

✉️ Email Designers

Embed logos directly in HTML email templates so they render without image-blocking prompts.

📝 Technical Writers

Create self-contained HTML documentation with screenshots baked into the file.

🎨 CSS Designers

Use data URIs for tiny background textures and decorative elements without extra asset files.

Common Mistakes

Converting large images to data URIs

Base64 encoding adds roughly 33% to file size. A 500 KB PNG becomes a ~667 KB string sitting inside your HTML. That bloats the page and kills caching. Stick to images under 10 KB — icons, small logos, simple graphics.

Dropping the MIME type prefix

A raw Base64 string won't render as an image. Browsers need the full data:image/png;base64, header to know what they're looking at. This tool adds it automatically, but if you're trimming the output manually, don't cut that part off.

Using data URIs and expecting browser caching

External image files get cached by the browser — data URIs don't. If you embed the same icon on 20 pages, every single page load re-downloads that string. For repeated assets, a regular image file with proper cache headers is the better call.

Technical Details

Frequently Asked Questions

What is a data URI?

A data URI is a way to embed file data directly in a URL string. Instead of pointing to a file on a server, the URL itself contains the content — encoded as Base64 text. Browsers decode it on the fly and treat it exactly like a regular image source.

How big can the PNG be?

Technically, there is no limit — the conversion happens in your browser's memory. But practically, you want to keep it small. Anything over 10–15 KB as a data URI starts hurting page load more than a separate HTTP request would. For large photos, just use a normal image file.

Does this work with JPEG or SVG files?

This particular tool is set up for PNG files and outputs the image/png MIME type. If you feed it a JPEG, the Base64 encoding will work but the MIME header won't match. For other formats, use a converter that matches — or change the MIME type in the output string manually.

Will data URIs work in all email clients?

Not all of them. Gmail strips data URIs from emails. Apple Mail and Outlook on Mac handle them fine. Outlook on Windows is hit-or-miss depending on the version. Always test your specific email client before relying on embedded images.

Is my image uploaded anywhere?

No. The conversion runs entirely in your browser using JavaScript. Your PNG file never touches a server. Close the tab and it's gone — there's nothing stored on our end.

Share: