Shrink SVG files by stripping editor metadata, rounding path data, shortening colours and dropping unused IDs, with a pixel check that the render is unchanged.
Design tools save far more into an SVG than a browser needs to draw it. Inkscape records its zoom level and window position, Illustrator stamps its version into a comment, and coordinates come out with six decimal places. The SVG Optimizer removes that weight, rounds what is left, and then renders the old and new file side by side and compares them pixel by pixel. You can see that nothing visible changed.
Each step is a separate checkbox, so you can keep anything a later build step depends on. Paste the code, drop an .svg file on the input box, or use Open .svg. Download saves the result with .min.svg added to the original name.
The page opens on a 48 × 48 map pin saved by Inkscape: an <?xml?> declaration, a sodipodi:namedview block, RDF metadata and a path written as M 24.000000,4.000000 C 15.163444,4.000000. With the default settings:
style properties become attributes, five unused IDs are removed, and the empty layer group is unwrapped.M24 4C15.16 4 8 11.16 8 20, and the render check reports 0.01% of pixels differing at 256 × 256.Load Sample then moves through an Illustrator export, a Figma export with an unused gradient, and a hand-written badge.
A <style> rule beats a presentation attribute but loses to an inline style. Moving style="fill:…" onto an attribute could therefore let a stylesheet rule win where it used to lose. When the file contains any <style> element, that step is skipped automatically.
Defaults such as stroke="none" are removed only when no parent element sets the same property, because a child's none may be overriding a stroked group. IDs survive whenever anything refers to them, whether through url(#…), href="#…", aria-labelledby or a CSS selector. Whitespace inside <text> is never touched. Markup whose root is not an SVG is rejected with a message like “The markup parsed, but its root element is <div>, not <svg>.”
Decimal places defaults to 2, which is invisible on icons drawn at screen sizes. At 0, the map pin's render check rises to 0.46%: curve control points snap to whole pixels and the outline shifts slightly. Relative path commands carry rounding error forward from segment to segment, so a long path in lowercase commands drifts more than one written in absolute coordinates.
The check counts a pixel as different when any colour channel moves by more than 8 out of 255. Under 0.5% is reported as identical. Files over 5 MB are refused to keep the tab responsive. Embedded raster images inside the SVG pass through unchanged, and both previews load as images, so a <script> inside the file never runs.