Optimize an SVG file
The SVG optimizer shrinks an SVG file by removing what cannot affect the render: editor metadata, XML comments, empty attributes and groups, unused ids, indentation between tags, and excess decimal places in coordinates. It is the one tool here that never touches a canvas — the markup is parsed into a tree, cleaned, and written back out as text, with the browser's own XML parser run over the source as a second opinion. Both versions are drawn side by side so you can see that nothing moved, and the before and after byte counts are shown with the percentage saved.
How it works
- Drop an SVG Drop or browse for an .svg file, or paste the markup from the clipboard. Raster images are refused with a message saying so — this tool reads SVG markup, not pixels.
- Set the decimals The Decimals slider keeps between 0 and 6 decimal places in coordinates, paths, transforms and the viewBox. Two is safe for screen graphics; at zero every coordinate snaps to a whole unit and the tool tells you to check the render.
- Choose what to strip Four toggles cover metadata (<metadata>, <title> and <desc>), XML comments, whitespace between tags, and unused ids. Each one re-runs the optimization as you change it.
- Check the render and the list The Render panel draws the original and the optimized markup next to each other, and the Removed list names exactly what came out and how many of each — comments, editor attributes, empty groups, unused ids, long numbers.
- Take the result Copy optimized source puts the markup on the clipboard, and Download optimized SVG saves it alongside your original as a .min.svg file.
Questions
- Will optimizing change how my SVG looks?
- That is the rule the tool is built around. Ids are only dropped after every reference in the document has been collected, whitespace inside <text> and similar elements is left alone, an empty xmlns is never treated as an empty attribute, and attribute entities are never decoded. The only setting that can visibly change a drawing is rounding coordinates to very few decimals, and the tool warns you at zero.
- Does it remove ids my JavaScript or CSS depends on?
- No. Before any id is dropped, the tool collects every reference in the document — url(#id), href="#id", aria attributes, SMIL begin and end timings, and anything inside a <style> block. And if the file contains a <script> element at all, every id is kept, because a script can look an element up by a name the optimizer cannot see.
- What if my SVG is already minified?
- Then the output may come out the same size or slightly larger, and the tool says so and tells you to keep the original rather than quietly handing you a worse file. It also warns when stripping metadata removed a <title> or <desc>, since screen readers announce those and an SVG that is content rather than decoration should keep them.
Every tool