SVG Optimizer
SVG Optimizer
Paste SVG code to remove comments and metadata, collapse whitespace and shorten colours, with before and after file sizes.
This is a basic optimizer. It only removes comments, metadata, empty groups and extra whitespace, and shortens hex colours. It does not change the drawing itself, and it does not rewrite paths or shapes.
About the SVG optimizer
An SVG file is plain text, and the files that design tools export usually carry extra text that has nothing to do with the picture itself: comments, titles, descriptions, metadata, empty groups and long hex colour codes. To optimize SVG files like these, this tool strips that extra text away and shows you the file size before and after, so you can see exactly how many bytes you saved. It does not change the drawing itself.
It is a simple, focused optimizer. You paste SVG code into the box, tick the cleanups you want, and press one button. The result is the same picture with leaner code, ready to copy or download as an .svg file. Because the work happens in your browser, an unpublished logo or a client icon set never has to be sent anywhere.
Smaller SVGs load faster and are easier to read when you open them later. If you inline icons in a web page or keep logos in a project folder, running them through this tool first is a quick tidy-up that costs nothing and changes nothing you can see.
How to use
- Paste your SVG code into the box, or press “Use sample” to try the tool with a small example first.
- Tick or untick the five cleanup options. All five are on by default, and you can turn any of them off if you want to keep something, such as the title and description.
- Press “Optimize SVG”. The before and after sizes appear, along with the percentage saved, and the cleaned code shows in the output box.
- Press “Copy optimized SVG” to copy the result, or “Download .svg” to save it as a file. Press “Clear” to start over with a fresh file.
Key features
- Removes comments from the SVG
- Removes title, description and metadata elements
- Removes empty groups
- Collapses whitespace between tags
- Shortens hex colours such as #ffffff to #fff where it is safe
- Shows before and after size in bytes and the percentage saved
- Checks the input and reports bad SVG clearly instead of failing quietly
- Copy the result or download it as an .svg file
Common uses
Cleaning up icons and logos exported from Figma, Illustrator or Inkscape before they go on a website. Tidying SVG code you plan to paste inline into HTML. Stripping author notes and editor data out of files you share with a client.
Frequently asked questions
No. This tool only removes comments, metadata, empty groups and extra whitespace, and shortens hex colour codes to an identical colour. It does not move, resize or redraw any shape, so the picture stays the same.
It depends on the file. Exported SVGs with lots of comments and metadata can shrink a lot, while a file that is already clean may shrink by only a few bytes. The tool shows the exact before and after sizes, and it will say so honestly if a file grows slightly because the parser rewrote the markup.
No, and that is worth knowing before you choose. SVGOMG is a full SVGO interface with a precision slider, a live preview and path-level optimization. This tool is a simpler basic optimizer: it cleans comments, metadata, empty groups and whitespace and shortens colours, but it does not rewrite paths or shapes and has no preview. If you need path work or precision control, use a full SVGO tool. For a quick cleanup, this one does the job in seconds.
No. This tool works from pasted code only: open your .svg file in a text editor, copy the code and paste it into the box. There is no file upload and no drag and drop.
No. The optimization runs entirely in your browser, and your SVG code never leaves your device.
Paste your SVG code into the box, or press Use sample to try it with a small example first. Tick the cleanups you want, press Optimize SVG, and the cleaned code appears with the before and after sizes.
It removes comments, title, description, and metadata elements, plus empty groups and extra whitespace between tags. It also shortens hex colours such as #ffffff to #fff where the colour stays identical.
Yes. All five cleanup options are on by default, but you can untick any of them before optimizing, for example if you want to keep the title and description.
Press Copy optimized SVG to copy the cleaned code, or Download .svg to save it as a file. Press Clear to start over with a fresh file.
The tool checks your input and reports bad SVG clearly instead of failing quietly. Fix the error in your code and try again.
