SVG Optimizer

Paste or drop in an SVG, strip comments, metadata, editor cruft, and excess whitespace. See the size drop live.

Click to choose an .svg file, or drag and drop it here

Or paste SVG markup directly into the box below. Stays on your device.

Remove width/height (keep viewBox only)

Preview appears here.


          

How it works

The cleanup pass removes XML/DOCTYPE declarations, <!-- comments -->, editor-only namespaces and metadata (Inkscape, Sketch, Illustrator export attributes, <metadata> and <title> blocks left over from design tools), and collapses redundant whitespace between tags, none of which affects how the SVG renders. Optionally, it can also drop explicit width/height attributes on the root element so the SVG scales purely from its viewBox, useful when embedding it responsively.

Everything is text processing on the string you provide, done with your browser's own DOM parser to make sure the result stays valid XML. Nothing is uploaded.

Common questions

Will optimizing change how the SVG looks?

No, everything removed is either invisible metadata (comments, XML declarations, editor-specific attributes) or insignificant whitespace between tags. The rendered shape is identical, only the file's byte size shrinks.

Why does my SVG still have a big file size after optimizing?

If most of the size comes from the actual path data (many points in a complex shape) or an embedded raster image, cleanup alone won't shrink much, since that data is part of the visible content. This tool focuses on safe, lossless cleanup rather than simplifying paths, which can subtly change shapes.

Is my SVG uploaded anywhere?

No. Optimization runs entirely in your browser's JavaScript. Nothing is uploaded.