Image to Base64 Data URI
Convert an image file into a Base64 data URI, CSS background rule or HTML img tag for embedding small icons directly in code.
Runs on your device
Result
Results appear here after you select “Convert”.
What it does
Embedding tiny icons as data URIs saves an HTTP request. The tool verifies the file really is an image and warns when the result is too large to be worth inlining.
How to use it
- Choose a small image (ideally under 10 KB).
- Pick the output format.
- Copy the snippet into your code.
Example
The example generates a small sample file in your browser and runs the tool on it. Select Try an example above to see it.
When it helps
- Inline icons in HTML emails.
- Single file HTML prototypes.
- CSS sprites replacement for tiny assets.
Questions
Why does the data URI get bigger than the file?
Base64 adds about 33% overhead. Inline only small images; serve large ones as normal files.
Are SVG files supported?
This tool accepts raster formats. For SVG, URL-encoding is usually smaller than Base64.
More image tools
See all 12- Favicon Generator Create favicon.ico plus 16, 32, 180, 192 and 512 px PNG icons from one square image, with the HTML link tags to paste into your site head.
- Image Colour Palette Extractor Extract the dominant colours from a photo or logo as hex codes with their share of the image, ready to paste into CSS or design tools.
- Add Text Watermark to Image Stamp a text watermark on a photo in any corner, the centre, or tiled across the whole image, with adjustable size, colour and opacity.
- Image Metadata (EXIF) Remover See whether a JPEG or PNG carries EXIF, GPS, XMP or text metadata, then download a clean copy with all of it removed. Fully local.
- Placeholder Image Generator Create placeholder images at any size with custom colours and label text, as SVG or PNG, for wireframes, mockups and layout testing.
- Image Compressor Reduce JPEG and WebP file size by choosing a quality level, with before and after sizes shown. Images are compressed in your browser, not on a server.
People also use
Browse all 200 tools- One Rep Max Calculator Estimate your one rep max from any set of up to 12 reps using the Epley, Brzycki and Lombardi formulas, with a percentage training table. Health & fitness
- Word & Character Counter Count words, characters with and without spaces, sentences, paragraphs and lines, with reading and speaking time estimates. Works with Urdu and emoji. Text & writing
- Profit Margin & Markup Calculator Calculate profit, gross margin and markup from cost and price, or find the selling price needed to hit a target margin, and see why margin and markup differ. Business
- Click Speed Test (CPS) Measure your clicks per second over 5, 10 or 30 seconds, and keep your best score. Also useful for checking a mouse for double clicking. Device tests