SVG Optimizer

Shrink SVG markup by removing comments, metadata, editor namespaces and ids — the drawing data itself is never touched, with byte savings shown.

Developer Tools Runs in your browser · no upload

Reviewed 17 November 2026 · Free · No account needed

ExecutionYour browserInput never leaves your tab
File retentionNoneNothing is stored
AccountNot requiredNo sign-up, no paywall
PriceFreeNo trial, no usage cap on the tool itself

How to use

  1. Paste the SVG markup.
  2. Read the optimized output and bytes saved.
  3. Copy the cleaned SVG into your project.

Example

Input: Icon exported from Inkscape with metadata

Output: Clean icon · ~30–60% smaller, rendering unchanged

How it works

The SVG is parsed and redundant attributes and comments are removed, then the markup is re-printed compactly. The rendered image is unchanged.

Blocks are deleted in order: comments, <metadata>, <title>, <desc>, the XML declaration and doctype. Then the root element is cleaned — sodipodi/inkscape attributes, editor namespace declarations, data-name, and the root id and class are stripped while xmlns is kept (re-added if missing) — and whitespace between elements is collapsed. Paths and styles are never modified.

Worked example

An Inkscape-exported icon carrying metadata typically comes out 30–60% smaller, rendering pixel-for-pixel the same, with the saving shown before you copy it.

Edge cases to know

  • Structural cleaning only — no path simplification, float rounding or transform collapsing.
  • ids and classes are removed on the root element only; inner ids survive, so fill="url(#…)" references do not break.
  • If the xmlns declaration is missing after cleaning it is re-added, so the SVG still renders standalone.
  • For deep optimisation (path simplification, precision reduction) use a build-time tool such as SVGO.

Limits & compatibility

  • Structural cleaning only — no path simplification, float rounding or transform collapsing.
  • ids and classes are removed on the root element; inner ids survive so fill="url(#…)" references don't break.
  • For deep optimisation use a build-time tool (SVGO) in your pipeline.

Privacy

Optimisation runs locally in your browser. Your file is never uploaded or stored.

Related tools

FAQ

Questions about SVG Optimizer

What does it strip from an SVG?

Comments, <metadata>, <title> and <desc> blocks, the XML declaration and DOCTYPE, editor namespaces and their attributes (Inkscape and Sodipodi leftovers), plus id and class on the root element. Whitespace between elements is collapsed. The drawing itself — paths, shapes, styles — is never rewritten, and byte savings are shown before you copy anything.

Will url(#…) references still work after cleaning?

Yes — ids and classes are removed on the root element only, so inner ids that gradients, filters and masks point at survive intact. What it deliberately does not do is path simplification, float rounding or transform collapsing, because those can alter rendering. Rendering-affecting changes are out of scope by design.

How much smaller will my file get, and when should I use SVGO instead?

Icons exported from editors typically shrink roughly 30–60% because the bloat removed is metadata rather than drawing data. That is also the boundary of this tool: it is structural cleaning for hand-off and inline use. Deep optimisation — path simplification and numeric precision reduction — belongs to a build-time tool such as SVGO in your pipeline.