SVG optimizer
Shrink SVG files with a from-scratch subset optimizer: strip comments, redundant attributes, whitespace and empty groups, simplify numbers, and compare the size before and after.
Runs in your browserEvery computation happens in your browser — your data never leaves this device.
Paste SVG
Text-level safe optimisations only — no path merging and no coordinate rewriting.
Result
Paste an SVG and press Optimize.
What this tool does
- SVG exported from Figma or Illustrator is full of comments, indentation and redundant attributes — one pass usually saves 20–60% and shaves kilobytes off the critical path.
- Slim an SVG down before inlining it into HTML, especially icon sprites that get repeated dozens of times.
- Check third-party SVGs for <metadata> or comments that leak author information, and clean them before shipping.
- Turn number simplification off and compare, so you can confirm the optimisation did not change rendering before keeping it.
Example
Input
<svg version="1.1" width="100.00"> <!-- icon --> <g></g> <path d="M0.5000 1.0L10.00,20.00Z"/> </svg>
Output
<svg width="100"><path d="M.5 1L10 20Z"/></svg>
The comment, the empty <g>, version="1.1" and the extra whitespace are gone, and 0.5000 became .5 while 1.0 became 1.
Frequently asked questions
Will optimisation change how it renders?
The seven default switches only make render-equivalent substitutions: dropping comments, the XML declaration, DOCTYPE and empty groups, collapsing whitespace between tags, removing derivable attributes like version, and writing 0.5000 as .5. Only "drop default fill / stroke" is a heuristic (fill defaults to black, stroke to none), which is why it is off by default — turn it on once you have verified the result.
Does it merge paths or rewrite coordinates?
No. Merging paths, converting to relative commands or recomputing coordinates needs a full path parser, and a single mistake changes the artwork — the risk far outweighs the gain. This tool sticks to text-level substitutions you can verify by eye.
Why did my file barely shrink?
That means the SVG was already minified (many exporters emit compact markup by default). Check the change list: if every counter is zero there was nothing to remove, and the only remaining wins are simplifying the artwork itself or compressing it with gzip / brotli over the wire.
Does collapsing whitespace break text elements?
No. Only whitespace between ">" and "<" is collapsed, which is the indentation between tags; the contents of <text> are untouched. If your SVG relies on xml:space="preserve" for layout, leave the whitespace switch off.
Is the file uploaded?
No. Optimisation runs entirely in the browser with no network requests, and whatever you paste lives only in the memory of this page.
Keywords:svg 优化svg 压缩svg optimizerminify svg去除注释路径数值简化矢量图瘦身svg 体积去冗余属性svg 美化