Related Tool

SVG Cleaner

Minify and clean SVG markup for smaller file sizes. All processing occurs locally in your browser.

Related Tools

SVG Pattern BuilderBase64 Converter

Strips SVG markup down to a single compact line. It removes comments, collapses every run of whitespace to one space, deletes the gap between a closing and an opening tag, and removes spaces around braces, semicolons and colons. The result is shown back as plain text you can copy.

How to use it

  1. Paste the SVG source into the box, replacing the small circle example if you like.
  2. Press Clean SVG; the compacted markup appears directly underneath.
  3. Select the result and copy it into your file or data URI.

Worked example

<svg width="100" height="100"> <circle cx="50" cy="50" r="40" fill="blue" /> </svg>becomes<svg width="100" height="100"><circle cx="50" cy="50" r="40" fill="blue" /></svg>

The space before the self-closing slash is inside the tag and survives; the newline and indentation between the tags do not.

<svg> <!-- note --> <text>Hello World</text> </svg>becomes<svg><text>Hello World</text></svg>

The comment is gone, and the run of three spaces inside the text node has collapsed to one.

When to use it

What it does not do