Free developer tool

SVG Optimizer

Paste your SVG code and the optimizer strips comments, metadata and editor leftovers and rounds long decimals, then shows a preview and the size saved.

What is svg optimizer?

SVG files exported from design tools often contain editor data, comments and numbers with many decimals. Cleaning them gives smaller files that load faster and are easier to inline in a page.

This tool applies safe cleanups and shows a live preview, so you can see right away if anything changed.

How to use the svg optimizer

  1. Paste your SVG code.
  2. Choose how many decimal places to keep. Two is a good start.
  3. Press Optimize, check the preview and copy the result.

How the svg optimizer works

The tool removes the XML prolog, doctype, comments, metadata, editor specific tags and attributes, data attributes and extra whitespace. Long decimal numbers are rounded to the number of places you choose.

Worked example

An icon exported from a design app with coordinates like 2.123456 becomes 2.12, and a leading comment and XML header are dropped, saving about a third.

Common uses of the svg optimizer

  • Shrinking icons before inlining them in HTML.
  • Cleaning SVG logos exported from Illustrator or Inkscape.
  • Reducing page weight for faster loading.
  • Removing hidden metadata before sharing files.
  • Preparing SVG for use in CSS.

Tips and common mistakes

Keep the viewBox attribute. It is what lets the SVG scale correctly.

For complex artwork, compare the preview with the original at a large size.

Background: what to know before you rely on it

SVG is a text format, so every extra character counts. Design apps add many things that browsers never use, such as editor names, layer data and long decimals. Removing these can cut file size by half or more. Specialized tools such as SVGO go further, merging paths and converting shapes, and are worth using in a build process. Because SVG can contain scripts, only use files from sources you trust and never paste untrusted SVG into a live page without sanitizing it. Also remember that for large photographic images SVG is the wrong format, since raster formats are smaller for them.

Private, free and fast

This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all developer tools, or browse the full list of tools.

Frequently asked questions

Will optimizing change my image?

Not visibly at two decimals for most icons. Check the preview.

Does it merge paths?

No. It only removes non essential data and rounds numbers.

Is it safe for animations?

Check carefully. Simple cleanup should not break them.

Is my SVG uploaded?

No.

Related tools

Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Do not paste live secrets into any website.