SVG to CSS Data URI Generator
Convert raw SVG vectors into background-image CSS and Base64 data URIs.
Lightest weight format for stylesheets and inline CSS.
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%231f4a3f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E %3Ccircle cx='12' cy='12' r='10'/%3E %3Cpath d='m9 12 2 2 4-4'/%3E %3C/svg%3E");Safe for image `src` attributes and JSON payloads.
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiMxZjRhM2YiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj4gPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTAiLz4gPHBhdGggZD0ibTkgMTIgMiAyIDQtNCIvPiA8L3N2Zz4=
How SVG to CSS Data URI Generator works
Strips comments, newlines, and excess whitespace from vector markup.
URL-encodes specific characters (#, %, <, >) to ensure cross-browser CSS validity without bloat.
Generates both lightweight URL-encoded CSS and Base64 strings.
Worked example
Paste an icon SVG to get an inline background-image rule ready for CSS stylesheets.
The tool above opens with these numbers. Change them to run your own scenario, or press Reset to come back to this example.
Frequently asked questions
Related tools
HEX, RGB and HSL in one place — plus the contrast verdict.
Craft smooth, multi-layer elevation shadows with CSS and Tailwind code.
Generate modern CSS clamp() formulas for smooth fluid typography and spacing.
Frame the shot — numeric crop with a live selection overlay.
Generate multi-size favicons and preview them in browser tab mockups.
Test foreground and background color combinations against WCAG 2.2 AA and AAA standards.
- svg
- css
- data-uri
- base64
- vector
- design