designwithfocus

SVG to CSS Background (Data URI)

Paste or upload SVG, get clean output.

Free No sign-up Runs in your browser
Upload an SVG file, or paste SVG below
Drag and drop, paste, or click to choose a file.

Processed in your browser. Nothing is uploaded.

background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22120%22%20height%3D%22120%22%20viewBox%3D%220%200%20120%20120%22%3E%0A%20%20%3C!--%20A%20simple%20mark%20--%3E%0A%20%20%3Ccircle%20cx%3D%2260%22%20cy%3D%2260%22%20r%3D%2252%22%20fill%3D%22%231B7F80%22%20%2F%3E%0A%20%20%3Ccircle%20cx%3D%2260%22%20cy%3D%2260%22%20r%3D%2234%22%20fill%3D%22%23FFC93C%22%20%2F%3E%0A%20%20%3Ccircle%20cx%3D%2260%22%20cy%3D%2260%22%20r%3D%2216%22%20fill%3D%22%23FFFFFF%22%20%2F%3E%0A%3C%2Fsvg%3E");

How to use SVG to CSS Background (Data URI)

  1. Paste your SVG code, or upload an SVG file.
  2. Adjust the options, then check the result.
  3. Copy or download the output.

How the SVG tool works

SVG is text, so the tool can edit it directly in your browser. Nothing is uploaded.

Optimising removes comments and extra whitespace. Converting changes the format, never the picture.

OutputUse
Minified SVGSmaller files for the web
Data URIInline SVG in CSS
JSXSVG as a React component
Base64Embedding SVG in other files

Good practice

Keep a copy of the original SVG. Minified code is hard to edit by hand.

Test the output in a browser before using it in production.

FAQ

Is SVG optimisation free?

Yes. It is free, with no sign-up.

Does it upload my SVG?

No. Everything runs in your browser.

Will optimisation change how my SVG looks?

No. It removes only comments, whitespace and redundant data.

Can I use the output in React?

Yes. The JSX converter produces a component you can paste into a React file.

Report a problem with this tool