Type a tool name, for example "keyword density" or "transcript".
Optimize and clean SVG files by removing unnecessary metadata, comments, and redundant attributes to reduce file size.
This SVG optimizer cleans up SVG code you paste in, removing comments, editor metadata, unused IDs, empty attributes and stray outer whitespace to shrink the file. It is made for web developers, designers and site owners who want lighter vector graphics that look exactly the same. It is free and needs no sign-in.
An SVG file is a text-based vector image format (Scalable Vector Graphics) that describes shapes, paths, colors and text as XML code instead of pixels. Because the image is code, it stays sharp at any size, from a 16 pixel icon to a full-width banner.
The same trait creates a size problem. Design apps such as Inkscape or Illustrator add a lot of material that browsers never use: an XML declaration, comments, editor-specific namespaces, layer names stored as IDs, and descriptive tags. That extra text is downloaded by every visitor. When an SVG is placed inline in your HTML, it also makes the page itself heavier.
You control five options, and all of them are switched on by default:
The XML declaration at the top of the file is always stripped, since browsers do not need it for SVG used on a web page.
You can optimize an SVG in under a minute by pasting its code, choosing options and clicking one button. Here is the full flow:
If you change the pasted code or any checkbox after optimizing, the old result is hidden so you never copy stale output. Click Optimize SVG again to refresh it.
Say you export a logo from Inkscape and the file weighs 4.00 KB. The top of the file has an XML declaration, a generator comment, a metadata block with RDF licensing data, a title, and a dozen attributes beginning with inkscape: and sodipodi:. Most shapes also carry auto-generated IDs like path1042, and a few elements have an empty style attribute.
You paste the code, leave all five boxes ticked and click Optimize SVG. The tool reports Original 4.00 KB and Optimized 2.60 KB. The saving is 1.40 KB, and 1.40 divided by 4.00 is 35.0%, which is what the Savings card shows. The logo renders the same because every removed item was editor bookkeeping, not drawing instructions.
Treat those numbers as an illustration. Your own result depends on how much editor data your file contains.
The Savings percentage tells you how much of the original text was removable, and the right next step depends on the number.
Use this table to decide which options to keep on for each situation:
| Option | Safe to keep on when | Turn it off when |
|---|---|---|
| Remove comments | Comments are only notes | A license notice must stay |
| Remove metadata | The image is decorative | You need title or desc for accessibility |
| Trim outer whitespace | Always | Rarely needed |
| Remove unused IDs | The SVG is a standalone file | Page CSS or scripts target those IDs |
| Remove empty attrs | Always | Rarely needed |
To optimize SVG for the web, remove what browsers ignore, keep what users and assistive technology need, and then compress the file when your server delivers it. This tool covers the first step. Web servers can also apply gzip or Brotli compression to SVG responses, and because SVG is plain text it compresses well, so the two steps stack.
A sensible workflow is to export from your design app, run the code through this page, test the result, then deploy. If the graphic is a favicon source, the favicon generator accepts SVG input and builds the icon sizes for you. For photos and other raster files, use the image compressor instead, since SVG cleanup only applies to vector code.
Anyone who ships SVG on a website will find a use for it. These are the situations where it earns its keep:
Most problems come from the input format or from removing something your page still needs. These are the cases people run into most.
The input box is empty or contains only spaces. Paste the full markup and click the button again.
Your code is not valid SVG. Common causes: a missing closing tag, an unquoted attribute value, a missing xmlns="http://www.w3.org/2000/svg" declaration, or extra HTML wrapped around the svg element. The outermost element must be svg. Fix the markup and try again.
Some files use editor prefixes in a way that breaks once the related declarations are removed. Untick Remove metadata, run it again, and the other cleanups will usually still work.
The most likely cause is Remove unused IDs. The tool only checks whether an ID is referenced inside the pasted SVG. If your page CSS, JavaScript or an external stylesheet targets that ID, untick the option.
Removing metadata also removes title and desc elements, which some graphics use as their accessible name. If the image carries meaning, untick Remove metadata, or add an aria-label or a short title back after optimizing.
This tool performs safe text cleanup, not deep redesign of the graphic. It does not simplify path data, round decimal coordinates, merge shapes, convert shapes into paths or collapse whitespace between tags. Trim outer whitespace affects only the beginning and end of the file, so spacing inside the markup is left as written.
That conservative approach is why visual changes are rare, but it also means savings on already tidy files will be modest. If an SVG is large because of thousands of path points, the fix is to simplify the artwork in your editor, then run it through the optimizer again.
If you work with other image formats, the image editing and optimization tools collection covers compression, cropping and metadata cleanup. For JPEG photos that contain location data, the EXIF data remover handles that separately.
Paste your SVG code into the box above, keep the options that suit your project and click Optimize SVG to see exactly how many kilobytes you can save.
Your report has been submitted. We will look into this issue.
A VPN changes your network exit. It does not guarantee anonymity.
Themes, plugins, code, video, audio, graphics & more from 90,000+ authors.
Web Development
Design & Media
Unlimited Access
Explore Envato Market