Optimize and minify SVG files over a real markup tokenizer, then verify the result by drawing both versions and comparing every pixel.
Initializing in your browser…
Compress to a quality or to a file size, with the size shown being the encoded file to the byte and the cost measured on the pixels: SSIM, PSNR, the worst channel and the share of pixels changed.
Resize with the filter named (Lanczos, Mitchell, Catmull-Rom, bilinear, box or nearest) and the option to average LIGHT rather than stored bytes, which is worth 1.24 stops on a detailed picture.
Trace a PNG or JPG into real SVG paths, with holes that stay holes and transparency that is not read as black. The page counts the pixels its own vector differs from the picture, and at the exact setting that count is zero.
An Inkscape export, run through the optimiser at its safest setting.
In the file
<sodipodi:namedview id="namedview1" pagecolor="#ffffff" inkscape:zoom="4"/>
What the page reports
1.24 KB to 578 B, 54.3% saved Both files were drawn at 320 by 320 and not one of the 102,400 pixels changed. removeEditorData: a <sodipodi:namedview> element, 75 B removeMetadata: a <metadata> block, 252 B
The previous version stripped that element with a regular expression whose [^=]* ran past the element NAME to the first equals sign, leaving "< pagecolor=..." and a file the browser refused to draw, at every preset including Safe. Working on markup tokens makes that impossible, and rendering both files and comparing the pixels is what proves it.
Shrink an SVG by removing what a drawing program left behind, and then check that it still draws the same picture. Both files are rendered at the same size and every pixel is compared, so the page can say whether anything moved rather than only how many bytes went.
Strip the editor metadata and namespaced attributes, with a check that the picture came through.
Collapse the whitespace and shorten the ids for markup that goes straight into HTML.
Let the tool try every precision and pick the smallest that costs nothing, rather than guessing at three places.
A 1.24 KB Inkscape file drops to 578 bytes under the safe preset with not one of 102,400 pixels changed, where the previous version produced markup the browser refused to draw at all.
The file is taken apart into markup tokens by the same lexer this site's XML formatter uses, rather than searched with patterns, and every rule then acts on a thing it can actually identify. That matters because the previous version was a stack of about a dozen regular expressions, and measured against the only reference an optimiser has, which is rendering both files and counting the pixels that moved, it failed in four separate ways. An Inkscape export came out UNRENDERABLE at every preset including the one called Safe: the attribute-stripping pattern ran greedily past an element name to the first equals sign and turned a self-closing sodipodi:namedview into a stray angle bracket, which a browser refuses to draw. A file using ordinary SVG features lost 14,986 of 102,400 pixels at the default preset, 14.63 percent, worst channel 255. And two checkboxes, Remove Unused Defs and Shorten Ids, were rendered, set by presets, and read by nothing.
Each of those has the same cause and the same fix. Whitespace is now removed only from text nodes that are whitespace and NOTHING else, which is the one rule XML has without a schema, so a text element keeps its double spaces and xml:space="preserve" is honoured. Comments are removed as comment nodes, so the characters that look like a comment inside a text element survive. Numbers are rounded only in attributes whose value really is a number (the path data, the coordinates, the transforms, the viewBox), so a document that prints pi to eight places still prints pi to eight places. Colours are shortened only in attributes that really hold a colour, so id="red" is left alone, and an eight-digit #RRGGBBAA is left alone too: the old pattern matched its first six digits and turned #aabbccdd into #abcdd, a different colour with a different alpha. Both dead options now work, and shortening an id rewrites every url(#...) that refers to it in step.
After every change the page does the thing the copy used to merely assert: it draws both files at 320 by 320 and compares every pixel, and says either that not one of the 102,400 changed or exactly how many did and by how much on the worst channel. On the four corpus files the safe preset now changes zero pixels every time, where the old one made one of them unrenderable. Because the check exists, a new button becomes possible: try every coordinate precision from 6 down to 0, render each, and select the smallest one whose output is pixel identical. On one test file that is five decimal places, a saving the default three would have taken at the cost of 194 moved pixels.
One rule changed on principle rather than on a measurement. A title element is the accessible NAME of an SVG and desc is its description (SVG 1.1 section 5.4), and the old tool removed both at every preset. They are kept by default now; the aggressive preset still removes them, and says what that costs. The output is also checked for well-formedness with a line, a column and the specific problem, and every rule that fired is listed with what it removed and how many bytes it saved, so the saving is attributable rather than a single percentage.
The page tells you, for your file. Both versions are drawn at 320 by 320 and every pixel is compared, and the verdict is either that none of the 102,400 changed or exactly how many did. The safe preset changes none on any of the corpus files; rounding coordinates is the setting that can move things, and it reports what it moved.
It depends entirely on what the file carries. An Inkscape export in the test corpus drops 54 percent under the safe preset and 71 percent under the aggressive one, almost all of it metadata and namespaced attributes. A hand-written file with none of that saves almost nothing, and the page shows every rule that fired with the bytes it saved so you can see where the saving came from.
Because they are the accessible name and description of the graphic (SVG 1.1 section 5.4). Removing them means a screen reader announces nothing for it. The aggressive preset still removes them and warns.
It runs the optimiser at every coordinate precision from six decimal places down to zero, renders each result, and picks the smallest one that changes no pixels. That is a per-file answer, which is why no fixed default can be both small and lossless.
Images are decoded, edited, and exported entirely inside this browser tab. No originals, exports, or metadata are uploaded.