🎨 CSS Data URI Converter
Drop an image to generate a ready-to-use CSS background-image data URI.
Drop image here or click to browse
About the CSS Data URI Converter
This converter takes an image file and produces a complete CSS declaration, background-image: url('data:...;base64,...');, ready to paste into a stylesheet. Unlike Image to Base64, it has no format options and outputs only this CSS line. The image is read in your browser with the FileReader API and is not uploaded to the TeqCave server. The MIME type in the URI is the type your browser reports for the file.
How to use
- Drop an image onto the drop zone or click it to choose one.
- Copy the declaration with the Copy button. The box shows only the first 200 characters.
- Paste it into a CSS rule and add background-size or background-repeat as needed.
Example: An 8×8 SVG dot
dot.svg (107 bytes): <svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><circle cx="4" cy="4" r="4" fill="red"/></svg>
background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiPjxjaXJjbGUgY3g9IjQiIGN5PSI0IiByPSI0IiBmaWxsPSJyZWQiLz48L3N2Zz4=');
Frequently asked questions
Which images are worth inlining in CSS?
Small images used on most pages, such as icons, bullets and simple patterns. Every inlined image is downloaded with the stylesheet, even on pages that don't show it, and makes the CSS file larger.
Is Base64 the best choice for SVG?
Not always. SVG is text, so a URL-encoded SVG (data:image/svg+xml,%3Csvg...) is often shorter than Base64. This tool only produces Base64, which avoids escaping problems with quotes and # characters.
Can I use the same data URI in HTML?
Yes. Take the part inside url('...') and use it as the src of an img tag. The Image to Base64 page can also output a complete img tag.