DT Dev Tools

SVG Optimizer

Optimize SVG files with SVGO in your browser. Compare before and after previews, check the bytes saved and download the result.

🔒 Runs entirely in your browser — nothing is uploaded

Drop an .svg file here or click to browse — or paste SVG markup below

Before: –After: –Saved: –
Original
Optimized
Advertisement

Why optimize SVG files

SVG files exported from design tools such as Illustrator, Figma, Sketch or Inkscape contain much more than the shapes you see. Editor metadata, XML comments, hidden layers, default attribute values, unused definitions, excessive decimal places and redundant groups can easily make up half of the file. This tool runs SVGO — the same optimizer used by most build pipelines and icon libraries — to remove that overhead. Smaller SVGs load faster, make inline icons lighter in your HTML and keep repositories tidy.

The default preset applies dozens of safe transformations: it removes the XML declaration, comments, metadata and editor namespaces, cleans up IDs, shortens colors, merges paths, converts basic shapes to compact paths when that is shorter and rewrites path data with relative commands and fewer digits. Multipass repeats the process until no further savings are found, which often squeezes out a few extra percent.

Choosing the options

Precision controls how many decimal places are kept in numbers; 2–3 suits icons, while detailed illustrations or maps may need more. Remove <title> saves bytes but removes the accessible name, so keep it for meaningful graphics. Remove viewBox should normally stay off, because the viewBox is what lets an SVG scale responsively. Remove width/height is useful when CSS controls the size. Remove scripts & event handlers strips <script> elements, on* attributes and javascript: links, which is a good habit for SVGs from unknown sources. Pretty print indents the result for readability at the cost of a few bytes.

Private, local and safe previews

All processing happens in your browser; files are not uploaded. Both previews are displayed through an image element that loads a local blob URL, and browsers never execute scripts inside SVGs shown this way. Always compare the two previews before using the output: aggressive precision or removing the viewBox can change how a graphic renders. The size badges show the byte savings so you can balance file size against visual fidelity.

How to use

  1. Add an SVGDrop an .svg file or paste SVG markup into the input.
  2. Choose optionsSet multipass, precision and optional removals such as title, viewBox or width and height.
  3. Optimize and compareClick Optimize SVG and compare the original and optimized previews and sizes.
  4. DownloadCopy the markup or download the optimized .svg file.

Frequently asked questions

Which optimizer does this use?
SVGO, the standard open-source SVG optimizer, with its default preset plus the optional plugins you tick. It runs in your browser.
Should I remove the viewBox?
Usually not. The viewBox is what lets an SVG scale cleanly with CSS. Only remove it when the SVG is always shown at its fixed width and height.
What does precision change?
It sets how many decimal places coordinates keep. Lower values give smaller files; values that are too low can visibly distort curves, so compare the two previews.
Is it safe to preview untrusted SVG files?
Yes. Previews are rendered with an image element from a local blob URL, which browsers display without running scripts. You can also strip scripts and event handlers from the output.
Advertisement