SVG optimizer

Paste your SVG code and get a smaller, cleaner version: no comments, no editor metadata, no unnecessary whitespace. See exactly how much you saved.

  • Free
  • No sign-up
  • Runs in your browser
svg-optimizer

100% private — your text is processed in your browser and never sent to any server.

Next step

Keep going with your result in another tool. Nothing is uploaded.

How it works

Paste your SVG code

Exported from Illustrator, Figma, Inkscape or hand-written.

Choose what to clean

Comments, metadata, empty groups, spacing and decimal precision.

Copy or download

The optimized SVG, with the saved percentage.

Why an exported SVG is bigger than it needs to be

Design tools save a lot more than the shape of your icon. A file exported from Illustrator, Figma or Inkscape usually carries an XML declaration, editor-specific metadata, comments, long generated ids on every element, empty groups left over from editing, and coordinates with far more decimal places than a screen can ever show. None of that changes how the icon looks, but it adds up in a page that loads dozens of icons or in an email signature with limits on size.

What gets cleaned

  • Comments left by design tools or written by hand.
  • Editor metadata, such as Inkscape and Adobe Illustrator namespaces, the sodipodi:namedview block, and long ids like path1234 that only the editor needs.
  • Empty groups such as <g></g>, left behind after edits.
  • Extra whitespace between tags, repeated spaces and line breaks that only matter for reading the source, not for rendering it.
  • Decimal precision. Coordinates with six or seven decimal places are rarely needed; rounding to one or two decimals shrinks the file with no visible difference.
  • Fixed width and height, optionally, so the icon scales freely wherever you place it, using only its viewBox.

See the difference

Below the result you see the size before and after, and the percentage saved, so you know at a glance whether it was worth it. Icons with long paths and many decimal places usually shrink the most; already tidy, hand-written SVG shrinks less.

What it does not do

This is a text-based cleanup, not a full XML optimizer: it does not merge overlapping shapes, simplify paths mathematically or convert strokes to fills, which a dedicated design tool does better. Very unusual or malformed SVG may not clean up perfectly. Nothing is uploaded; the code is processed in your browser. To turn the result into a PNG, use the SVG to PNG converter.

Frequently asked questions

How do I reduce the size of an SVG file?
Paste its code here and keep the default options on. Comments, editor metadata and extra spaces are removed, and you can also round decimal numbers.
Is it safe to remove Inkscape and Illustrator metadata?
Yes. That metadata only helps the editor that created the file; it has no effect on how the SVG looks or works elsewhere.
Why round the decimal numbers?
Coordinates with many decimal places are more precise than any screen can show. Rounding to one or two decimals shrinks the file with no visible change.
Should I remove the width and height attributes?
Only if you want the icon to scale freely with CSS. If you removed them, keep the viewBox attribute, since it defines the shape's proportions.
Will this break my SVG?
The default options are safe for typical exported SVG. Always check the preview or open the result to confirm it still looks right.
Is my SVG code uploaded?
No. It is cleaned in your browser.