You export an icon from a design tool, drop it on a web page, and find the file is far bigger than the drawing deserves. Design tools write editor data, comments, long decimal numbers and unnecessary groups into the file. An optimizer removes all of that without changing how the picture looks. The SVG Optimizer uses SVGO in your browser. This guide explains what it changes, which settings are safe and when to leave an option off.
What gets removed
- XML declarations, comments and editor metadata, such as the Inkscape namespace and layer names.
- Empty groups and attributes that equal their defaults.
- Excess decimals in path data. A path written with six decimals rarely needs them.
- Long ids, which can be shortened.
The tool's sample file shows this: it starts with an XML header, an Inkscape comment, a title, a metadata element and layer attributes, and has coordinates like 10.000000. The optimized version keeps the shapes and drops the rest.
Step by step
- Drop one or many SVG files, paste SVG code into Or paste SVG code, or try the sample.
- For each file, look at the original and the optimized version side by side, with the size before and after, and a badge showing the percentage saved or "Already small".
- Adjust the settings if needed.
- Download one file, copy the code, or download several as a ZIP (optimized-svgs.zip). Files are saved with a .min.svg name.
The settings, and when to change them
| Setting | Default behaviour | Change it when |
|---|---|---|
| Precision (0 to 6 digits) | Decimal places kept in paths. 2 to 3 is invisible on screen according to the tool | Lower it for smaller files on simple icons; raise it if a detail shifts or curves look wrong |
| Keep viewBox | On | Almost never. Without a viewBox, an SVG cannot scale to its container |
| Shorten ids | On | Turn it off if your CSS or JavaScript refers to ids in the SVG, or if you inline several SVGs on a page and need predictable ids |
| Keep title and description | On | Keep for accessibility; turn off only for purely decorative graphics |
How to be sure nothing broke
- Compare the two previews. They should look identical.
- Zoom a browser tab with the optimized SVG; thin lines and curves reveal precision problems.
- Test the file in the place it will be used: inline in a page, as an image, or in your app. Inline SVGs that rely on CSS selectors or animation need the ids and classes they refer to.
If a detail has moved, raise Precision by one and optimize again.
Optimizing cases that go wrong
- Animated SVG with ids. Animations that target an element by id break when ids are shortened. Turn Shorten ids off.
- Several SVG sprites on one page. Two files that both shorten ids to the same names can collide when inlined. Keep ids or give each sprite a prefix in your build.
- SVGs with embedded fonts or images. Optimizing does not make these smaller in any special way, and embedded bitmaps stay as they are. Consider compressing the bitmap before embedding.
- A file that turns out bigger. It is flagged "Already small"; keep the original.
Optimizing is not vectorising
The optimizer works on SVG that already has shapes. If your logo is a PNG, convert it first with PNG to SVG, and then optimize the result, since traced SVGs often have a lot of path data. If you need a bitmap version of the optimized file, the SVG to PNG tool exports one at 1x, 2x or 4x.
Limits
There is no fixed file size limit, but very large SVGs of several megabytes take a few seconds, because the work happens on your device. The optimizer cannot simplify the drawing itself; a map with thousands of nodes stays complicated unless you reduce Precision or simplify the paths in a design tool.
A worked example: an icon set from a design tool
A designer exports twenty icons. Each includes a comment naming the editor, a metadata block and path coordinates with six decimals. Drop all twenty files into the optimizer at once and watch the before and after sizes per file. Each card shows the original and optimized drawings next to each other. Leave Precision at its default for the first run, and scan the twenty previews for any that look different. If one icon has very thin curves and appears slightly changed, optimize it again with a higher Precision. Download the lot as a ZIP, and the folder of .min.svg files is ready for the website.
Pasting code instead of uploading files
If your SVG lives in a code editor, paste it into the Or paste SVG code box instead of saving it to a file. The optimized code can then be copied back. This is handy for inline SVG in a template, where you want the markup to be short because it is repeated on every page that includes it.
Why file size matters for SVG
An inline SVG is part of the page's HTML, so extra metadata is downloaded by every visitor on every load. A file that is linked as an image can be cached, but it still has to be fetched the first time. Trimming editor leftovers is one of the cheapest improvements you can make to a page, since it changes nothing that a visitor can see.
FAQ
Will the picture look different?
At the default precision the difference is not visible. Always check the side-by-side preview.
Is my SVG uploaded?
No. SVGO runs in your browser.
Can I optimize many at once?
Yes. Drop several files and download them as a ZIP.
Should I gzip SVGs on my server?
Text compression on the server works well on SVG, and it adds to what the optimizer already saved. It does not replace it.