About the SVG Optimizer
Vector editors save far more than the drawing: XML declarations and doctypes, <metadata> blocks, sodipodi: and inkscape: attributes, unused gradients, hidden layers, default values and coordinates with eight decimals. This tool runs SVGO 4 with its preset-default plugin set, which removes that data, collapses groups, rewrites path data in its shortest form and rounds numbers to the float precision you choose. Editor exports usually shrink by 50–80%.
The options map to SVGO plugins. The viewBox is kept by default because without it the image cannot scale with CSS; “Remove width/height” (removeDimensions) does the opposite and makes the SVG fill its container. <title> is kept by default since it is the accessible name of the image. “Clean up IDs” shortens and removes unused IDs, which breaks CSS or JavaScript that refers to them, and “Prefix IDs” avoids collisions when several SVGs are inlined in one page. “Styles to attributes” (convertStyleToAttrs, not part of the preset) rewrites style="fill:red" as fill="red" so that default values can be dropped. “Replace colors with currentColor” makes an icon take the text color of its parent.
Optimisation is lossy in small ways: a precision of 1 or 0 visibly distorts small icons, and merging paths can change how overlapping shapes are drawn. That is why both versions are rendered next to each other — as <img> elements, where the browser never executes scripts or loads external resources of the SVG. The gzip figures show what is actually transferred when the server compresses responses, which is the fair number to compare.
How to use it
- Paste the SVG markup, open a file or drop an .svg on the input.
- Set the float precision — 3 is safe for most artwork, 2 or 1 suits simple icons.
- Tick the plugins you need: remove dimensions, prefix IDs, currentColor, xmlns for inline use.
- Compare the original and optimized previews and the sizes.
- Copy the result or download it as optimized.svg.