Skip to main content

SVG Optimizer

Optimize and minify SVG files

SVG source

Upload or drop a file, or paste markup. Processing stays in your browser.

SVG markup
Comments, metadata, and redundant markup are removed where safe.0 Bytes

Was this SVG Optimizer helpful?

Help us keep tools reliable, fast, and bug-free.

What you can do with SVG Optimizer

  • Reduce svg file size
  • Minify vector graphic

How this media processing works

Minify, clean, and optimize SVG vector files by removing metadata, hidden layers, redundant precision, and unused attributes with SVGO.

Example input

<?xml version="1.0"?><!-- Generator: Figma --><svg xmlns="http://www.w3.org/2000/svg" width="24.000" height="24.000" viewBox="0 0 24 24"><metadata>Icon</metadata><path d="M12.000 2.000 L22.000 20.000 Z"/></svg>

Example output

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="m12 2 10 18Z"/></svg>

Practical workflow

  1. Paste your raw SVG code or drop an SVG vector graphic file into the optimizer.
  2. Select Optimize SVG to run SVGO's preset-default configuration; this page does not expose per-plugin settings.
  3. Compare the original and optimized previews, then check the byte change metric, which reports an increase when the output is larger.
  4. Copy the minified SVG code or download the clean vector SVG file.

Common use cases

  • Minifying vector icon sets and illustrations to improve website Core Web Vitals and load times.
  • Cleaning bloated SVG assets exported from Figma, Illustrator, or Sketch before committing to Git.
  • Removing hidden editor metadata, author comments, and personal layer names from public graphics.

Important notes and limitations

  • The browser runs SVGO's preset-default optimizer. It removes comments, metadata, and redundant syntax, and may simplify path data or numeric precision; compare the previews because complex artwork can render slightly differently.
  • Pasted markup and uploaded SVG files are capped at 2 MB before XML parsing and optimization to bound browser work.

SVGO (SVG Optimizer) CLI terminal commands

Optimize SVG file with SVGO

npx -y svgo input.svg -o output.svg

Strips editor metadata (Inkscape/Illustrator), comments, and redundant groups to shrink SVG file size by 40-70%.

Batch optimize folder of SVGs with multipass

npx -y svgo -f ./icons -o ./optimized --multipass

Runs multiple compression passes across directory to minimize coordinate precision and compress curves.

Path distortion & precision loss troubleshooting

SVG shapes distorted or paths collapsing after optimization

Cause: Float coordinate precision set too low (e.g. precision: 1 or 0), rounding critical bezier curve points.

Solution: Increase float precision to 2 or 3 in svgo.config.js ('floatPrecision: 3') to preserve detailed vector paths.

SVG animations or interactive IDs removed during optimization

Cause: Default 'cleanupIDs' and 'removeUnknownsAndDefaults' plugins stripping custom IDs referenced by CSS/JS.

Solution: Disable 'cleanupIDs' in SVGO configuration if targeting SVGs with CSS animations or defs/use references.

Continue your workflow

Frequently asked questions

What changes can SVGO make to my SVG markup?

SVGO's preset-default removes comments, metadata, and redundant syntax, and may simplify paths or numeric values. Compare the original and optimized previews before using output where exact rendering matters.

Why do vector graphics exported from Figma or Illustrator have extra bloat?

Design tools include proprietary XML namespaces, editor history tags, layer names, and full-precision coordinates that are unnecessary for web rendering.

Does SVG optimization always make the file smaller?

No. Results depend on the input markup. The tool compares original and optimized byte sizes and labels an increase when the output is larger; keep the source when optimization does not help.