SVG Optimizer

An SVG straight out of Illustrator, Figma or Inkscape is mostly not drawing. It carries a doctype and declaration an inline SVG never needs, a generator comment, metadata and title elements, editor namespaces no renderer reads, empty groups left by the export, and coordinates written to fifteen decimal places when three are already finer than any screen can show. Strip those and a typical icon loses a large fraction of its size without a pixel changing. Coordinate precision is usually the biggest single win, since path data is the bulk of the file. What this will not do is rewrite paths, merge shapes or collapse transforms — those save more and are exactly where aggressive optimisers change the rendering in ways that only show up at some sizes. Before and after previews sit side by side so you can check. Everything runs in your browser.

What an exported SVG wastes space on

ContentNeeded?
XML declaration and doctypeNo, for an inline SVG
Generator commentNo
metadata, title, descOnly if used for accessibility
inkscape: and i: attributesNo, editor-only
Empty <g> groupsNo
Coordinates at 15 decimalsNo — 2 or 3 is ample
viewBoxYes, always — keeps it scalable

When to use it

  1. Shrink icons before shipping them in a bundle.
  2. Clean an Illustrator or Figma export for inline use.
  3. Strip editor metadata before sending an asset to a client.
  4. Make an SVG small enough to inline as a data URI.
  5. Remove a hard-coded width and height so an icon scales to its container.

How to Use

  1. Drop an SVG or paste its source.
  2. Choose which passes to apply and the decimal precision.
  3. Compare the before and after previews.
  4. Copy or download the result.

Features

  1. Removes comments, doctype and XML declaration
  2. Removes metadata, title and desc elements
  3. Strips Illustrator, Inkscape and Sodipodi attributes
  4. Trims coordinate precision, with trailing zeros dropped
  5. Removes empty groups, repeatedly
  6. Optional width and height removal, viewBox always kept
  7. Side-by-side before and after preview
  8. Refuses malformed markup with a line and column
  9. 100% client-side

FAQs

Is my file uploaded?

No. It is optimised in your browser. Both previews are rendered from blob URLs rather than injected as markup, so nothing in your file is ever parsed as part of this page.

Will it change how my SVG looks?

Only through coordinate rounding, and only by the precision you choose. Nothing rewrites paths, merges shapes or collapses transforms. Compare the two previews before shipping — at 2 or 3 decimal places an icon is normally indistinguishable.

Where does most of the saving come from?

Coordinate precision, usually. Exporters write far more digits than any renderer can use, and path data is the bulk of the file. Metadata, editor attributes and the doctype are easy wins too but are a fixed cost rather than a proportional one.

Should I remove width and height?

Only for inline use. Without them the SVG scales to its container, which is usually what you want in HTML or CSS. But it then has no intrinsic size, so used as an <img> or a background it may render at an unexpected size. The viewBox is always kept, since without it the SVG cannot scale at all.

Why is my file barely smaller?

It was probably already optimised, or it is dominated by embedded raster images or fonts, which this does not touch. Hand-written SVG is usually close to minimal already.

My SVG was rejected as malformed.

Something in the markup is not well-formed — usually an unclosed tag. The line and column are given. Optimising invalid markup would risk producing something worse, so it is refused rather than attempted.

Technical Details

An SVG exported from a design tool is mostly not drawing instructions. It carries an XML declaration and doctype that an inline SVG does not need, a generator comment, metadata and title elements, editor-specific namespaces and attributes that no renderer reads, empty groups left behind by the export, and coordinates written to fifteen decimal places when three are already beyond what any display can resolve. Those are the passes here, and coordinate precision is usually the largest single saving because path data is the bulk of the file. Rounding is done only on well-formed decimal numbers, and the pattern deliberately requires a decimal point, so an id like path12 or a colour like #00ff00 is never touched — mangling either would break the file in a way that is hard to trace. Trailing zeros and a bare trailing point are removed after rounding, which is where much of the benefit actually lands. Empty groups are removed repeatedly rather than once, because deleting an inner group can leave its parent empty in turn. The whole thing runs on the same tokenizer as the XML formatter, so a greater-than inside an attribute, a comment containing markup, and CDATA are all handled correctly, and a malformed file is refused with a line and column rather than silently mangled. What this deliberately does NOT do is rewrite path data, merge shapes, convert primitives to paths or collapse transforms. Those save more, and they are also where aggressive optimisers change the rendering in ways that only appear at certain sizes or in certain renderers. Both previews are rendered from blob URLs rather than injected as markup, so nothing in a dropped file is ever parsed as part of this page.

Image Tools

Image Tools

  • HEIC to JPG
  • Image to Text (OCR)
  • EXIF Viewer
  • QR Code Reader
  • Color Palette Extractor
  • SVG to PNG
  • SVG Stroke to Fill
  • Background Remover