SVG Optimizer

Optimize SVG files free online. Remove comments, metadata, redundant code. Compress SVGs instantly, browser-based, no registration, no sign-up.

Free online file converter tool. Works in Chrome Firefox Safari Edge Opera and other modern browsers on Windows macOS Linux Android and iOS. No software installation required. Browser-side processing keeps your file local when supported. Completely free to use with no account needed.

SVG Optimizer

Minify and optimize SVG files by removing unnecessary code

Drop an SVG file here or click to select

SVG Optimizer Features

Clean and minify SVG files for faster web delivery

Remove Comments

Strip HTML and XML comments that are invisible to the user but add unnecessary bytes.

Strip Metadata

Remove Inkscape, Adobe Illustrator and other editor-specific metadata from SVG files.

Minify Markup

Collapse whitespace between tags and remove unnecessary spaces to reduce file size.

How to Minify an SVG for the Web

  1. Load your SVG file

    Drag an SVG onto the drop zone or click Select SVG to choose one. The file is read directly in your browser with the FileReader API, so nothing is uploaded. A preview of the file name and original size appears once it loads.

  2. Pick the cleanups to apply

    Toggle the options you want: remove comments, remove metadata and editor data, clean auto-generated IDs, remove empty groups, and remove empty attributes. The XML declaration and whitespace between tags are always collapsed. Enable more options for a larger size reduction.

  3. Optimize, compare, and download

    Click Optimize SVG to run the cleanup. You see the original size, the new size, the percent reduction, and a before and after visual preview. Click Download SVG to save the minified file, or Optimize Another to start over with a fresh file.

What Each Optimization Option Removes

This optimizer works by rewriting the SVG markup as text, removing data that has no effect on how the image renders. The table below shows what each toggle targets and whether it is always applied or optional. The visual output stays identical after these transformations.

OptionWhat it removesApplied
XML declarationThe leading processing instructionAlways
Whitespace collapseSpaces and newlines between tags, runs of multiple spaces, padding inside tagsAlways
Remove commentsHTML and XML comment blocks that never reach the viewerOptional
Remove metadata and editor datametadata, title and desc elements, Inkscape and Sodipodi attributes, and dc, cc, rdf namespacesOptional
Clean auto-generated IDsEditor IDs such as id="path1234" on common shape and group elementsOptional
Remove empty groups and attributesEmpty g elements and attributes with empty values, including empty style attributesOptional

Which Settings Fit Your Use Case

Inkscape or Illustrator export

These editors add the most overhead. Enable remove metadata and editor data plus remove comments to strip Sodipodi, Inkscape, and document namespaces. This is where you see the largest reduction.

Inline SVG in a web page

When you paste SVG directly into HTML, turn on clean auto-generated IDs so duplicate IDs from multiple icons do not collide. Combine with whitespace collapse for the smallest inline footprint.

Icons for a component library

Use remove metadata, clean IDs, and remove empty groups to get lean, predictable markup before importing into React, Vue, or a sprite. Keep an original copy for re-editing later.

Animated or scripted SVG

Leave clean IDs off if your CSS, SMIL, or JavaScript references elements by ID. The tool never touches animation markup, but kept IDs ensure your selectors still match after optimizing.

Common Problems and Fixes

The file is rejected on selection

The tool only accepts files with an SVG MIME type or a .svg extension. If your graphic was saved as .txt or another extension, rename it to .svg and try again. Files exported as PNG or JPG cannot be optimized here.

The size reduction is small

Clean, hand-written SVGs have little to remove. Larger reductions come from editor exports full of metadata. Make sure remove metadata, remove comments, and clean auto-generated IDs are all enabled to capture every saving.

An animation or interaction stopped working

If CSS, SMIL, or scripts target elements by ID, turning on clean auto-generated IDs can remove the IDs they rely on. Re-run the optimization with that option off, then download again.

I need to re-edit the SVG later

Optimization strips editor data that Inkscape and Illustrator use to reconstruct shapes, layers, and guides. Always keep the original source file as a backup, since the minified output is meant for delivery, not further editing.

References

  1. Scalable Vector Graphics (SVG) 2 - W3C
  2. SVG: Scalable Vector Graphics - MDN Web Docs, Mozilla
  3. SVGO - SVG optimizer
  4. SVG path data - W3C
  5. SVG viewBox attribute - MDN Web Docs, Mozilla
  6. SVGOMG - SVGO web interface
  7. XML introduction - MDN Web Docs, Mozilla
  8. Scalable Vector Graphics (SVG) 2 - W3C