SVG optimiser

Drop one or more SVG files. The tool removes what a viewer never needs (comments, metadata, editor-only elements and attributes, empty groups, unused namespace declarations), rounds coordinates to the precision you choose and compacts path data. It then renders the original and the result at 256 px on your device and compares them pixel by pixel, and tells you honestly whether the drawing is identical, differs only within a small tolerance, or has changed. Titles, scripts, classes, styles and every id something in the file names stay as they are; with the render check on it also takes what nothing in the file reaches (an unused definition, an empty group whose id nothing names) and writes colours and numbers in a shorter equal form, only where the drawing still renders the same.

SVG optimiser

or drop them here. Files stay on this device.

How it works

  1. Choose or drop one or more SVG files. Files that are not well-formed SVG are flagged in the list and skipped.
  2. Pick how many decimals to keep in coordinates (3 suits most drawings, and the render check shows whether a very small one changed; 1 suits icons drawn on a grid) and whether to keep the title and description.
  3. Press Optimise SVG. Each result shows its size before and after, what was removed, the original and the result side by side, and one of three render verdicts: identical (no pixel differs), within tolerance (small differences counted and listed, not called identical) or differs beyond tolerance, with the differing pixels shown in red. Download the files or one ZIP.

Questions

What exactly is removed?

XML comments, the DOCTYPE and processing instructions other than an <?xml-stylesheet?> line; the <metadata> element; elements and attributes in editor namespaces (Inkscape, Sodipodi, Adobe Illustrator, Sketch, Serif, RDF, Dublin Core, Creative Commons); empty <g> and <defs> containers that carry no attribute (one with an id, a class or a style stays, as something may look it up); the informational version attribute; namespace declarations nothing uses any more; and whitespace between elements. Numbers in coordinates, sizes, transforms, viewBox and path data are rounded to the chosen number of decimals and path data is written in its compact form. With the render check on, it also takes definitions (gradients, patterns, clip paths, masks, filters, markers) the drawing uses neither directly nor through another definition it uses, and empty <g> groups whose id nothing in the file names; and it writes colours in fill, stroke, stop-color, flood-color, lighting-color and color in their shortest equal form (#ffffff as #fff, rgb(255,255,255) as #fff, #ff0000 as red), and numbers in style declarations without the zeros that end them (1.000000 as 1). A file that holds a script or an event attribute, or links a stylesheet, gets none of this, since those could reach any id or value; a symbol with an id, and the definitions of a file that draws nothing itself (a sprite sheet other files use), always stay; and a file whose result would render differently with it gets the conservative result, its note saying so.

What is deliberately kept?

Everything that can change how the file looks or behaves: ids and classes (something outside the file may reference them; with the render check on, only an empty group whose id nothing in the file names, and a definition the drawing does not use, go), style attributes (where with the render check on only a colour or a number may be written in a shorter equal form) and <style> blocks, an <?xml-stylesheet?> line (it links a stylesheet outside the file), <script>, <title> and <desc> (screen readers announce them; there is an option to drop them), xml:space, default attribute values, and any element the tool does not recognise. Whitespace inside text, tspan, style and script is untouched. This is a conservative cleaner, not a full rewrite like SVGO: files from a clean export may shrink only a little, and the tool says so rather than inventing savings.

How does the render check work?

Both the original and the result are drawn at 256 by 256 pixels through an image element on your device and compared pixel by pixel. The verdict has three states. Identical: no channel of any pixel differs. Within tolerance: some pixels differ, each by at most 8 of 255 in a channel, or by at most 32 on a pixel that sits on an edge of the original drawing, where a neighbour differs from it clearly, which is what rounding a coordinate does to anti-aliasing; these pixels are counted and shown, and the file is not called identical. Differs beyond tolerance: any other difference, from a large move anywhere to a small but uniform change across an area such as a rounded colour or opacity, is reported as a count of pixels beyond tolerance, and the summary flags that file; its before and after views then gain a third view with the differing pixels marked in red. A change below the tolerance, such as an opacity of 0.99 rounded to 1, is real but too small for this check to call visible; it is never attributed to anti-aliasing unless the pixel is actually on an edge. The check is therefore tolerance-based, not a proof of identical bytes. SVGs that reference external files or that an image element cannot draw are reported as not comparable rather than as identical. The extra cleanup (see What exactly is removed?) stays in a file's result only when that result renders as the original within the tolerance; otherwise, and for a file that cannot be compared, the file gets the conservative result, and its note says when the extra cleanup was held back. With the check off, only the conservative cleanup runs.

Can rounding change the drawing?

Rounding to 3 decimals moves a point by at most half a thousandth of a unit of the drawing's own coordinates: invisible in a drawing tens or hundreds of units wide, but not in one whose viewBox is itself only a few thousandths wide. With 1 decimal a curve in a very small viewBox can shift slightly, and an opacity such as 0.96 becomes 1; that is why the render check exists. If the check reports differences, choose more decimals and run again. The two flags of an arc command are read as single characters, as the SVG grammar allows, so a compact path such as a10 10 0 0110 20 keeps its flags and endpoint.

Does it minify CSS or JavaScript inside the SVG, or convert shapes to paths?

No. Style blocks and scripts are passed through unchanged, and shapes stay as the elements they are. With the render check on, a colour or a number in a style attribute may be written in a shorter equal form (#ffffff as #fff, 1.000000 as 1); nothing else of a style is rewritten.

Is my file uploaded?

No. The page loads a small script into your browser and every operation runs on your device. You can check this yourself in the browser's network panel: after the page has loaded there are no upload requests. Closing the tab discards the file.

Do I need an account or to pay?

No. These basic tools are free, have no limits set by us and store nothing on our servers. The practical limit is your device's memory for very large files.

What does this page keep in my browser?

Nothing you open or type. While the tab is open, the tool pages keep a short list of the steps taken in it, in the tab's session storage: the step (page opened, started, succeeded, first success, used again or failed), the tool's name, the time, how many files were used and, for a failure, an error code; never a file name, the contents of a file or your text. It holds at most the latest 200 steps, and the browser deletes it when the tab closes. The page never sends it. Where a Report a problem button is shown, you can attach the last 20 steps to your report; nothing is attached unless you tick that box. In local storage the page keeps only choices you made: a Light or Dark theme until you choose System again, the language you picked with the EN / 中文 switch if it differs from your browser's language, and this tool in your recently used list if you switched that list on at the tools page.

Questions or problems

Found a problem or missing feature? Tell us. Please describe the steps; do not send confidential data.