SVG Minifier
Optimize SVG with SVGO — the real AST-based engine behind SVGOMG, not a fragile regex. Comments, editor metadata and whitespace gone; your path data, inline CSS, text and viewBox left intact. Nothing is uploaded.
Runs entirely in your browser — your SVG never leaves your device. Optimization uses the vendored SVGO parser; there are no network requests and the byte figures are measured directly with TextEncoder. These options are all fidelity-safe; this tool never rewrites your path geometry.
What this tool does
Paste an SVG on the left (or open a .svg file) and it is optimized on the right the instant you stop typing — no button to hunt for. You get a smaller, cleaner SVG, its size before and after in real bytes, the exact percentage saved, and a live side-by-side render of the input and output so you can see the picture is unchanged. Then copy it or download it as a .min.svg. Everything happens on your device: SVGO is vendored into the page, so nothing is uploaded.
Why SVGO, not a regex
An SVG is XML, and the tempting way to shrink it is a handful of regular expressions: delete <!-- … -->, squeeze runs of spaces, drop line breaks. It works on tidy input and quietly corrupts the parts that matter. A path such as d="M60 30 A30 30 0 0 1 90 60" is a stream of numbers where the spaces are load-bearing — strip the wrong one and the arc command falls apart. An inline <style> block is real CSS with its own braces and comments; a blind pass mangles it. <text> content and xml:space="preserve" runs depend on their exact whitespace. This tool avoids all of that by running SVGO — the same AST-based optimizer that powers SVGOMG — which parses the document into a tree first, so a space inside a path is never confused with a space between two tags.
Where the savings come from
Most SVGs exported from Illustrator, Figma, Inkscape or Sketch carry a surprising amount of dead weight: an XML declaration and doctype, an editor <metadata> block, editor-specific namespaces and attributes, empty groups, and generous indentation. On a typical editor export that cruft plus the whitespace is 20–60% of the file, and removing it changes nothing about how the image renders. The sample loaded above shrinks by roughly half from exactly those removals.
What it removes and what it keeps
| Removed / shortened | Always preserved |
|---|---|
Comments <!-- … --> and the XML/doctype prolog | Every path d attribute, byte-for-byte |
Editor <metadata> and editor namespaces | Inline <style> CSS |
| Insignificant whitespace & indentation | <text> content and spacing |
| Empty containers & attributes, unused namespaces | viewBox and your gradients / IDs |
Long hex colours in attributes (#ffffff → #fff) | The geometry — no curve is re-plotted |
Honest limits
This is a fidelity-first optimizer by design. It deliberately leaves off SVGO's most aggressive plugins — convertPathData (which re-plots your curves to shorter equivalents) and inlineStyles/minifyStyles (which move and rewrite your CSS) — because those squeeze out more bytes but can, in rare cases, shift a point by a rounding step or change how a stylesheet cascades. So expect solid, safe savings from cruft and whitespace removal, not the theoretical minimum a maximal SVGO run would reach. If you need every last byte and can eyeball the result, a full SVGOMG pass goes further. It also optimizes a single SVG's text: it does not rasterize, does not fetch external images or fonts an <image>/@font-face references, and does not combine multiple files. Very large or deeply-nested SVGs are processed synchronously, so a huge illustration may briefly pause the tab while it works.