deftools.io Design

SVG Optimizer

Optimize and minify SVG files online. Strip comments, metadata, editor data, and unnecessary whitespace to shrink file size.

Tip: press Ctrl/⌘ + Enter to optimize. You can also drag and drop an .svg file anywhere on the input above.

Input:
   
Try an example

About this tool

This tool shrinks SVG files by stripping comments, editor metadata (Illustrator, Inkscape, Sketch namespaces), XML declarations, DOCTYPE lines, and unnecessary whitespace. An optional precision rounder trims excessive decimal places from path coordinates — often single-handedly cutting 10–30% without visible rendering differences.

Example: an Illustrator-exported star icon at 820 bytes compresses to ~340 bytes — over 55% smaller — by removing the XML preamble, the RDF metadata block, comments, an empty layer group, and collapsing whitespace. A Feather heart icon drops from 580 to ~380 bytes.

Each toggle controls one pass: uncheck Comments, Metadata, or Empty groups to keep those parts intact. The precision option rounds floating-point coordinates (e.g., 12.34567 → 12.346 at 3 dp) to shave bytes from dense path data.

Enable Show preview to see the optimized SVG rendered side-by-side with the original — confirm the output still looks right before downloading it.

FAQ

Does optimizing change how the SVG renders?

No — for the default toggles. Comments, metadata, empty groups, and whitespace have no visual effect. The precision rounder may shift a path by a sub-pixel amount at extreme values, but 3 decimal places preserves 1/1000th of a user-unit, well below screen resolution.

Should I always remove metadata?

If you are shipping the SVG in production (a website or app), yes — metadata and editor namespaces add bytes but no rendering value. Keep metadata if the SVG is a working source file you plan to re-edit in Illustrator or Inkscape.

How does this compare to SVGO?

SVGO is the gold standard for build-pipeline optimization and offers more passes (collapsing transforms, merging paths, converting styles to attributes). This tool covers the highest-impact, safest optimizations that work in a browser, with zero install. Use SVGO in your CI pipeline; use this for quick one-off cleanups.

Can I optimize inline SVG from HTML?

Yes. Paste the entire SVG tag — including the opening <code>&lt;svg&gt;</code> and closing <code>&lt;/svg&gt;</code> — and the tool handles it. It strips only markup outside the SVG root element.

Related design tools

Copied!