Tools
SVG optimiser
Clean up and slim down your SVG files by removing unnecessary code.
Drop an SVG file here
or click to select, or paste SVG code below
About this tool
SVGs exported from Illustrator, Figma or Inkscape tend to carry metadata, comments, empty groups and excess decimal places that add nothing to the drawing. Cleaning them up makes the file lighter, pages load faster and the markup is easier to read when you inline it in HTML or a component. It is worth doing for icons, logos and illustrations before they go on a website or into a repository.
Drop an .svg file onto the box, click to choose one, or paste the code straight into “Input SVG”. Optimisation happens automatically: you will see the original size, the optimised size, the bytes saved and the percentage reduction. Below that are the resulting code and a preview so you can check the drawing has not changed. Then use “Download optimised SVG” or “Copy SVG code”.
The work is done by SVGO, an open-source library, running entirely in your browser, so the file never leaves your device. It runs several passes with the default preset and removes the width and height attributes (keeping the viewBox) as well as any data-* attributes. It does not convert PNG or JPG images to SVG or trace bitmaps, and embedded raster images inside an SVG barely shrink.
Frequently asked questions
How much smaller does an SVG get after optimising?
It depends on where it came from. SVGs exported from design software often shrink by 20–60 %, while hand-written or already optimised files will barely change. The tool shows the exact saving for each file.
Does optimising an SVG change how it looks?
It shouldn’t: SVGO only removes information that doesn’t affect rendering and rounds coordinates to a precision you won’t notice. Still, check the preview, especially if the SVG uses filters, masks or complex animation.
Why does my optimised SVG fill the whole page width?
Because the width and height attributes are removed and the viewBox is kept, so the SVG scales to its container. Size it with CSS, or add width and height back into the code if you need them.
Are IDs and classes preserved?
Classes are kept, but SVGO’s default preset may shorten or remove IDs that aren’t referenced inside the SVG itself. If your CSS or JavaScript targets a particular ID, check it in the output.