Where an Exported SVG's Extra Weight Comes From
Design tools like Illustrator, Figma, and Sketch embed a lot of information into an SVG export that has nothing to do with how the shape renders: editor-specific namespaced attributes (inkscape:label, sodipodi:*) that only meant something inside the original app, <metadata>/<title>/<desc> blocks describing the file for the design tool's own UI, XML comments left over from the export process, and empty <g> wrapper groups from layer organization that no longer group anything meaningful once flattened.
None of it is wrong to have, but none of it affects the visual output either - it's pure overhead for a file whose entire job is to be a small, fast-loading icon or illustration.
Distinguishing Safe Cleanup From Risky Cleanup
The genuinely safe categories - comments, metadata blocks, empty groups, editor-only attributes - can be removed with zero risk to how the SVG renders, since none of them are referenced by anything else in the file. IDs are the one category that needs real care: an id is only safe to remove if NOTHING else in the file points to it via url(#id) (used by gradients, filters, and clip-paths) or href="#id" (used by <use> elements) - removing a referenced id silently breaks whatever depended on it.
This is exactly why a real XML parser (not a text-based find-and-replace) matters for this kind of cleanup - it lets the tool actually check whether an id is referenced anywhere in the document before deciding it's safe to drop.
Frequently Asked Questions
Because SOME of them genuinely are - a linear-gradient fill, a clip-path, or a reused
It depends on how much cruft the original export had - a simple icon with heavy editor metadata can sometimes shrink by 30-50%+, while a file that was already reasonably clean might only drop a few percent. The savings come entirely from removing non-visual content, not from altering the actual path data.
The cleanup categories this tool applies are specifically chosen to never touch visual elements (paths, shapes, fills, gradients, viewBox) - but always compare the before/after preview for anything with complex effects like clip-paths or filters, since those are exactly the features that depend on ids staying intact.
SVGO (and tools like it) can also round path-data coordinate precision, merge redundant paths, and convert simple shapes to path elements - deeper, more aggressive transformations of the actual geometry. This tool intentionally sticks to non-visual cleanup only, trading some extra possible savings for being simpler to reason about and impossible to accidentally distort a shape with.