SVG Optimizer

Clean up SVG files exported from Figma, Illustrator, Inkscape, or Sketch. The SVG optimizer removes editor data, rounds long numbers, and rewrites paths shorter, while the drawing looks the same.

Updated
Runs in your browser. Your SVG is not uploaded.

Your SVG

Settings

Runs as you type for files up to 100 KB.

Optimized SVG

Your optimized svg will appear here
  1. Paste SVG code, upload a file, or load a URL
  2. Pick the settings
  3. Copy or download the result

How to use the SVG Optimizer

  1. Paste your SVG code, drop an .svg file on the text box, or press Upload .svg.
  2. Set the Decimal places. 3 is safe for almost everything; 2 or 1 suits large, simple icons.
  3. Leave Merge paths off unless you check the preview afterwards.
  4. Compare the two previews, then copy the code or press Download .svg.

How it works

The tool runs SVGO, the standard open-source SVG optimizer, in your browser with its default set of safe plugins. Among other things it:

  • removes comments, the XML prolog, editor namespaces, hidden elements, and empty groups;
  • rounds numbers to the chosen precision and drops trailing zeros (64.000000 becomes 64);
  • rewrites path data with relative commands and shorter arcs;
  • turns shapes into shorter paths and shortens colors (#ffffff becomes #fff);
  • runs several passes, since one change often allows another.

The viewBox is never removed, so the icon still scales, and <title> stays for screen readers. Previews are shown as images, so any script inside the file never runs.

Examples

The sample is a 64 × 64 icon saved by Inkscape, 2,089 bytes long:

  • Optimized at 3 decimal places: 680 bytes, 67% smaller, and it looks the same.
  • Its path went from M 0.00000000,46.000000 C 10.500000,38.250000 ... to M0 46c10.5-7.75 18.75-8.5 28-3....
  • The sodipodi:namedview, <metadata>, and inkscape: attributes were removed.

Optimizer, minifier, or metadata remover?

ToolWhat it doesUse it when
SVG OptimizerAll safe optimizations, readable output if you likeYou want a smaller file you can still edit
SVG MinifierThe same plus shortest ids and no whitespaceThe file goes straight onto a website
SVG Metadata RemoverRemoves only editor data and commentsYou must not change the drawing code

Limitations

  • Merging paths can change how overlapping shapes with transparency look, which is why it is off by default.
  • Ids are renamed. If a script or stylesheet outside the file uses them, test the result.
  • Embedded bitmaps (base64 images) are left as they are.
  • Files up to 5 MB.

Frequently asked questions

Does optimizing an SVG change how it looks?

Not with the default settings. The safe plugins keep the drawing the same. Very low precision (1 decimal place) can shift fine curves slightly, so check the preview.

Why keep the viewBox?

The viewBox lets an SVG scale to any size in CSS. Without it an icon only works at its original width and height, so this tool never removes it.

What is SVGO?

SVGO (SVG Optimizer) is the widely used open-source tool behind most SVG compressors and build tools. This page runs the same code in your browser.

How much smaller will my SVG get?

Files exported from design apps often shrink by 30 to 70 percent. Hand-written or already optimized files shrink much less.

Often used together with the SVG Optimizer.

  • SVG Minifier

    Minifies SVG code to the smallest version that draws the same.

  • SVG Metadata Remover

    Strips editor data, comments, and metadata from SVG files and leaves the drawing alone.

  • SVG Validator

    Checks SVG files for XML errors, broken references, typos, and unsafe code.