Design apps write SVGs for round-tripping, not for browsers. They carry editor metadata, hidden layers, redundant groups and coordinates with six decimal places.
What's safe to remove
- Editor namespaces and metadata (Illustrator, Inkscape, Sketch, Figma).
- Comments, empty groups, hidden elements and default attribute values.
- Excess precision: for icons drawn on a 24-unit grid, two decimals are invisible.
What to keep
viewBox, which you need for responsive scaling.- IDs referenced by CSS or JavaScript. Turn off ID shortening if you target them.
titleelements on meaningful graphics, for accessibility.
Security
SVG is code. Inline only SVGs you trust, or run them through a sanitiser. The SVG Optimizer always strips scripts, event handlers and javascript: links.