An SVG straight out of Illustrator, Figma or Inkscape is mostly not drawing. It carries a doctype and declaration an inline SVG never needs, a generator comment, metadata and title elements, editor namespaces no renderer reads, empty groups left by the export, and coordinates written to fifteen decimal places when three are already finer than any screen can show. Strip those and a typical icon loses a large fraction of its size without a pixel changing. Coordinate precision is usually the biggest single win, since path data is the bulk of the file. What this will not do is rewrite paths, merge shapes or collapse transforms — those save more and are exactly where aggressive optimisers change the rendering in ways that only show up at some sizes. Before and after previews sit side by side so you can check. Everything runs in your browser.
| Content | Needed? |
|---|---|
| XML declaration and doctype | No, for an inline SVG |
| Generator comment | No |
| metadata, title, desc | Only if used for accessibility |
| inkscape: and i: attributes | No, editor-only |
| Empty <g> groups | No |
| Coordinates at 15 decimals | No — 2 or 3 is ample |
| viewBox | Yes, always — keeps it scalable |
No. It is optimised in your browser. Both previews are rendered from blob URLs rather than injected as markup, so nothing in your file is ever parsed as part of this page.
Only through coordinate rounding, and only by the precision you choose. Nothing rewrites paths, merges shapes or collapses transforms. Compare the two previews before shipping — at 2 or 3 decimal places an icon is normally indistinguishable.
Coordinate precision, usually. Exporters write far more digits than any renderer can use, and path data is the bulk of the file. Metadata, editor attributes and the doctype are easy wins too but are a fixed cost rather than a proportional one.
Only for inline use. Without them the SVG scales to its container, which is usually what you want in HTML or CSS. But it then has no intrinsic size, so used as an <img> or a background it may render at an unexpected size. The viewBox is always kept, since without it the SVG cannot scale at all.
It was probably already optimised, or it is dominated by embedded raster images or fonts, which this does not touch. Hand-written SVG is usually close to minimal already.
Something in the markup is not well-formed — usually an unclosed tag. The line and column are given. Optimising invalid markup would risk producing something worse, so it is refused rather than attempted.
An SVG exported from a design tool is mostly not drawing instructions. It carries an XML declaration and doctype that an inline SVG does not need, a generator comment, metadata and title elements, editor-specific namespaces and attributes that no renderer reads, empty groups left behind by the export, and coordinates written to fifteen decimal places when three are already beyond what any display can resolve. Those are the passes here, and coordinate precision is usually the largest single saving because path data is the bulk of the file. Rounding is done only on well-formed decimal numbers, and the pattern deliberately requires a decimal point, so an id like path12 or a colour like #00ff00 is never touched — mangling either would break the file in a way that is hard to trace. Trailing zeros and a bare trailing point are removed after rounding, which is where much of the benefit actually lands. Empty groups are removed repeatedly rather than once, because deleting an inner group can leave its parent empty in turn. The whole thing runs on the same tokenizer as the XML formatter, so a greater-than inside an attribute, a comment containing markup, and CDATA are all handled correctly, and a malformed file is refused with a line and column rather than silently mangled. What this deliberately does NOT do is rewrite path data, merge shapes, convert primitives to paths or collapse transforms. Those save more, and they are also where aggressive optimisers change the rendering in ways that only appear at certain sizes or in certain renderers. Both previews are rendered from blob URLs rather than injected as markup, so nothing in a dropped file is ever parsed as part of this page.