About this tool
Shrinks an SVG file by removing editor metadata, comments and default attributes and by rounding coordinate precision, without changing how it renders.
An SVG optimizer rewrites an SVG file to be smaller while drawing exactly the same picture. This one deletes editor leftovers that the SVG 1.1 rendering model ignores — comments, <metadata>, Inkscape's <sodipodi:namedview>, inkscape:* and sketch:* attributes — drops presentation attributes that merely restate their spec default such as fill-opacity="1" and stroke-linejoin="miter", and rounds path coordinates to a precision you choose. It is for designers exporting icons from Figma, Illustrator or Inkscape, and for developers inlining SVG into a bundle where every byte ships to every visitor.
Open SVG Optimizer on AltFTool — it loads instantly in your browser.
Upload or drag in the file you want to work with.
Adjust the settings and preview the result.
Download the finished file to your device.
Parsing, rewriting and downloading all happen in the page, so unreleased artwork never leaves your machine.
The default-value table is taken from the SVG 1.1 initial values, so removing an attribute cannot change rendering.
Every url(#id) and href="#id" in the file is collected first, so gradients, filters, clip paths and <use> targets keep their ids.
Editor exports commonly drop 50-80%. A typical Illustrator or Inkscape icon carries a generator comment, an XML declaration, a DOCTYPE, a metadata block and 6-9 decimal places on every coordinate; removing those and rounding to 3 decimals is where nearly all of the saving comes from. Hand-written SVG that is already tidy may only lose a few percent.
Two or three decimals for almost everything. Rounding to 3 decimals moves any point by at most 0.0005 user units, which on a 24-unit icon viewBox scaled to 24 CSS pixels is 0.0005 of a pixel. Use 0 only for artwork deliberately drawn on a whole-number pixel grid, and raise it above 3 only for maps or charts drawn on a viewBox thousands of units wide.
Yes for normal web use. An SVG served as image/svg+xml or inlined into HTML needs neither: the declaration only matters when the encoding is not UTF-8, and the SVG 1.1 DTD was never used for validation by browsers — the W3C itself advises against including it. Keep them only if a specific legacy consumer demands them.
No, as long as the reference is written in the file. The tool scans the whole source for url(#id), href="#id", xlink:href="#id" and SMIL begin/end references before it removes anything, and keeps every id it finds. Ids referenced only from external CSS or JavaScript are the one exception — turn off "Remove unreferenced ids" in that case.