01 / Drop
Add your SVGs
Drop files, paste code, or press Ctrl or Cmd V. Many at once is fine.
Free tool
This SVG optimizer makes SVG files smaller by taking out what a browser never draws: comments, editor data, metadata, empty groups and extra digits. Drop one file or a whole folder, see the size before and after, and drag a slider over the picture to check it looks the same. Safe mode never changes how a file looks. It runs in your browser with SVGO, so nothing is uploaded.
| File | Before | After | Saved |
|---|
What was taken out
What each step saved
Your SVG files are read and shrunk in this page. Nothing is uploaded.
How it works
01 / Drop
Drop files, paste code, or press Ctrl or Cmd V. Many at once is fine.
02 / Check
Drag the slider over the picture. A pixel check draws both versions and counts any difference.
03 / Save
Save one file, or all of them in a ZIP. A file that cannot get smaller is kept as it was.
Guide
An SVG optimizer makes an SVG file smaller by removing what a browser never draws and writing the rest in fewer characters. This one runs SVGO, an open source SVG optimizer, version 4.1.0, inside your browser. Safe mode only removes things that do not draw, so the picture stays identical. Stronger mode runs SVGO's full default set. Either way a pixel check draws both versions and tells you if anything moved.
Safe removes the doctype, the XML line, comments, the metadata block, editor data from Inkscape, Sketch and Illustrator, unused namespaces, empty groups and empty attributes. It writes colours and path data shorter and keeps numbers to 8 decimal places, far finer than any screen can show. It keeps ids, classes, shapes and groups as they are. Stronger is SVGO's full default set: it also turns shapes into paths, joins paths, merges groups, moves styles onto elements, drops attributes that only repeat a default and rounds numbers to the places you choose, from 0 to 6. Three places is the default.
These six test files were made for this page and checked in this tool. Your files will differ, but the pattern is typical: editor exports shrink most.
| Test file | Original | Safe | Stronger |
|---|---|---|---|
| Inkscape-style logo, with doctype, comment, metadata, editor data | 3,412 bytes | 1,820 bytes | 1,587 bytes |
| Chart, with rects, lines and text | 1,364 bytes | 1,314 bytes | 982 bytes |
| Icon set, with a style block, symbol and use | 1,066 bytes | 1,003 bytes | 795 bytes |
| Illustrator-style export with a filter and a mask | 1,212 bytes | 1,087 bytes | 986 bytes |
| Text on a path, with a pattern | 692 bytes | 675 bytes | 658 bytes |
| 24 pixel star icon | 147 bytes | 144 bytes | 144 bytes |
On the Inkscape-style logo, Safe went from 3,412 to 1,820 bytes, which is 46.7% smaller: 1,592 bytes saved. The steps list shows where it came from: the editor data alone was 768 bytes, the metadata block 198 bytes, spaces and line breaks 174 bytes and shorter numbers 106 bytes. In the pixel check, all six files came out identical in Safe. In Stronger, four were identical. The Illustrator-style file had 1,366 of 699,392 pixels that differed by 1 out of 255, and the chart had 1,641 of 655,360 pixels that differed by at most 13 out of 255, tiny shifts along the edges of shapes that the page reports each time.
Keep ids as they are is on by default, because CSS or JavaScript outside the file may point to an id, and shortening it would break that link. If nothing outside the file uses them, turn it off in Stronger: on the logo that took the result from 1,587 to 1,319 bytes. Keep title and description is also on by default, since screen readers read them. Turn it off only for a purely decorative picture.
If you place the SVG inline in a web page, its style rules can affect the rest of the page, and the page's CSS can reach into it. Check the result in the page itself before you replace the old file.
If the pixel check shows a difference you can see, switch to Safe, or keep ids and keep the decimal places at 3 or more. If the browser cannot draw a file, it is probably not valid SVG. Files over 20 MB are skipped. To turn a picture into SVG first, use image to SVG, and to turn an SVG into a PNG use SVG to PNG.
Questions
Drop it on this page, keep Safe selected and download the result. Safe removes comments, editor data, metadata and empty groups and writes numbers shorter, so the picture stays the same.
Not in Safe. The page draws the original and the result in your browser and compares every pixel, so you see the proof for each file. Stronger can move a few edge pixels by a tiny amount. In the six test files it moved at most 0.25% of pixels, and the check tells you how many for your file.
It depends on the file. Exports from Inkscape or Illustrator carry the most extra data. In the six test files above, Safe saved from 2% to 47% and Stronger from 2% to 54%.
No. SVGO runs in a worker in this page, and your files stay in your browser.
SVGO is an open source SVG optimizer under the MIT licence. This page uses version 4.1.0, served from this site, and does not change its code.
It may already be as small as SVGO can safely make it, like the 24 pixel star above. The page then returns your original file and says so.
Yes. Drop them together or use Add more files. Each gets its own size, picture and pixel check, and Download all as a ZIP saves them together.
Keep them if CSS, JavaScript or another file refers to them, and in doubt. Turn the option off in Stronger only when nothing outside the SVG uses its ids.