Convert SVG code to a CSS background-image data URI. No external files needed.
Preview β
Why Use SVG as CSS Background?
- No extra HTTP request β the SVG is embedded directly in your CSS
- Scalable β looks sharp at any size
- Customizable β change colors by editing the SVG code
- Small file size β SVG data URIs are often smaller than base64-encoded PNGs
Example
.icon {
width: 24px;
height: 24px;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' ...");
background-size: contain;
}