Or try an example
src or CSS background-image.Help Us Improve
—
(—)
Image to data URI — convert image to URL online
Free image to URL converter: turn a picture into a base64 data URI for HTML img src or CSS background—copy the image link string in your browser.
What is image to base64 / data URI?
Image to base64 / data URI features
Raw base64 data URI
Copy data:image/…;base64,… for any paste target — png to base64 included.
HTML image tag
One-click <img src="…"> for email HTML and static pages.
CSS background
Ready-made background-image: url("…") rule.
Original file bytes
Uses FileReader—keeps the source format, including animated GIF.
Size readout
See file size and approximate data URI payload size.
Private conversion
No server upload; everything stays on your device.
How to convert image to base64
Upload a picture
Drop JPG, PNG, WebP, GIF, or another image (15 MB max).
Pick the output format
Choose raw Data URI (base64), HTML <img>, or CSS background.
Copy the result
Click Copy and paste into your HTML, CSS, or email template.
Tips for image data URIs
- 01
Keep files small
Data URIs work best under a few KB—compress icons before embedding.
- 02
HTML vs CSS caching
URIs in HTML are not cached like separate images; CSS reuse can still help within one stylesheet.
- 03
Prefer sprites for many icons
Dozens of data URIs bloat CSS—consider a sprite sheet or icon font instead.
- 04
Need a full page?
Use Image to HTML to download a complete HTML document with the image embedded.
- 05
Check MIME in the prefix
The data:image/png;base64, (or jpeg/gif/webp) prefix should match your file type.
- 06
Email clients vary
Some clients block or truncate huge data URIs—test signatures before sending.
Image to base64 / data URI tools compared
Online PNG Tools (convert PNG to base64)
Competitor ranking for png to base64 and image to base64. This page matches that intent with original-byte data URIs, HTML/CSS wrappers, and private browser encoding.
Ezgif.com Image to Data URI
Popular data URI converter with HTML/CSS options. Requires server upload.
Base64 to Image (/base64-to-image)
Reverse direction: paste base64 / data URI and download an image file.
Image to HTML (/image-to-html)
Builds a full HTML document; may re-encode via canvas instead of original bytes.
This image to base64 tool
Browser-only png/image to base64 converter with raw, HTML, and CSS outputs—no upload.
Perfect for these uses
Self-contained HTML emails: Embed small logos in signatures without external image hosting.
Single-file demos: Ship a prototype page with icons inline—no asset folder required.
CSS icon snippets: Paste tiny PNG/SVG-as-raster icons into background-image rules.
Docs and gists: Include screenshots in Markdown/HTML samples that travel as one blob.
Offline UIs: Keep critical images available when network requests are blocked.
Quick “image link” for code: Generate a pasteable image URL string without opening DevTools.
Why use this image to URL converter
Instant
Encode as soon as the file loads—no queue or wait.
Three output shapes
Raw, HTML, and CSS cover the usual paste targets.
Private
Images are not uploaded to convert.
Free
Unlimited copies without watermarks or accounts.
Format-faithful
Original MIME type and bytes, including GIF animation.
Works with the HTML tool
Use Image to HTML when you need a full downloadable HTML document.
Technical details
- Encoding
- Browser FileReader.readAsDataURL produces the data URI from original bytes.
- HTML wrap
- Optional <img src="data:…"> wrapper for paste-ready markup.
- CSS wrap
- Optional background-image: url("data:…"); rule.
- No re-encode
- Unlike canvas export, the source file is not quantized or recompressed.
- Input formats
- Common web images including JPG, PNG, WebP, GIF, BMP, SVG when the browser can read them.
- Limits
- 15 MB max upload; very long strings may hit clipboard or editor limits.
Sources & References
“Data URLs, URLs prefixed with the data: scheme, allow content creators to embed small files inline in documents.”
Data URLs: This tool generates data: URLs so images can be embedded inline without separate HTTP requests for the asset file. developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs
“The FileReader object lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer.”
FileReader API: Conversion uses FileReader.readAsDataURL so encoding happens entirely in the browser from the selected file. developer.mozilla.org/en-US/docs/Web/API/FileReader
“The HTML img element embeds an image into the document.”
HTML img element: The HTML output mode places the data URI in the img src attribute for self-contained markup. developer.mozilla.org/en-US/docs/Web/HTML/Element/img
“The background-image CSS property sets one or more background images on an element.”
CSS background-image: The CSS output mode wraps the data URI for use as a background-image value. developer.mozilla.org/en-US/docs/Web/CSS/background-image