Free SVG Optimize Online

Optimize SVG files with SVGO: strip editor metadata, shorten path data, round numbers and compare before and after. Runs in your browser, nothing uploaded.

No login. Files processed for your request and discarded. Free to use. Files processed & discarded →

Compress PDF — it's free or choose from 130+ tools

130+ Free Tools
— Files Processed
— Happy Visitors
— Pages Explored
0 Files Stored

SVG Optimizer and Minifier

Part of Image tools: See all Image tools.

What is SVG Optimize?

SVG Optimizer makes SVG files smaller with SVGO 4.1.0, the open-source optimizer used by many web build tools. It removes what browsers do not need to draw the image: Inkscape, Sodipodi and Illustrator metadata, comments, the XML declaration and DOCTYPE, empty groups and hidden elements, and default attribute values. It also rewrites path data in a shorter form, rounds coordinates to the precision you choose, shortens colors and merges paths and groups where that is safe. You see a before and after preview and the size in bytes, then copy the code or download it as an .svg file.

How to use SVG Optimize

  1. Open an .svg file, drag one onto the box, or paste the SVG code.
  2. Leave Number precision at 3 decimals unless you see a difference in the preview. Lower is smaller, higher is more exact.
  3. If the SVG is animated with CSS or JavaScript, or your code selects elements by ID or class, tick Keep IDs, classes and element structure.
  4. Click Optimize SVG and compare the Before and After previews.
  5. Copy the result or download it as name.min.svg.

Why use this tool?

SVGs saved from Illustrator, Inkscape, Figma or Sketch usually carry editor data, long decimal numbers and verbose path commands that the browser ignores. Every icon, logo and illustration on a page is downloaded by every visitor, so trimming them helps pages load faster, especially when SVGs are inlined in HTML or bundled into an icon set.

SVG Optimize — In-Depth Guide

An SVG is a text file that describes shapes with XML. Design tools write far more than the browser needs to draw them: an Inkscape file includes sodipodi:namedview and inkscape: attributes that record the canvas zoom and layer names, an Illustrator export adds a generator comment and sometimes a large metadata block, and almost every exporter writes coordinates such as 12.000001 with six or more decimals. SVGO reads the file into a tree, runs a set of small plugins over it, and writes it back out. The default set removes comments, metadata, editor namespaces, empty and hidden elements and attributes that just repeat the default value, then rewrites path data with relative commands and shorter numbers, shortens colors such as #ff0000 to red, and merges paths and groups where the result draws the same.

Precision is the setting that matters most. SVGO rounds numbers in coordinates and path data to the number of decimals you pick. For a 24 by 24 icon, 2 or 3 decimals is plenty. For a large illustration or a map with fine detail, 3 or 4 is safer. The previews show the original and the optimized file drawn by your browser at the same size, so check thin lines, small text and curves at the edges before you replace the original.

Optimization keeps the picture, not the document structure. That is ideal for a static logo or icon, but not for SVGs that code interacts with. If a stylesheet targets #logo-dot or .pulse, if a JavaScript animation library selects elements by ID, or if you swap colors with a class, tick Keep IDs, classes and element structure. The tool then leaves IDs, classes, <style> rules, shape elements, non-empty groups and elements hidden with display:none as they are and still removes metadata, comments and extra precision. Titles are kept, so an SVG that uses <title> for accessibility still has it, but desc elements that only contain an editor default are removed.

Optimization works together with server compression rather than replacing it. Minifying removes data; gzip or Brotli on the web server then compresses the text that is left, and the two savings add up. If you inline icons in HTML, run them through the optimizer first and use Pretty-print only when you want to read or edit the result. To turn an optimized SVG into a bitmap for an app store or social post, use SVG to PNG, and to check what changed, paste the two versions into Text Diff.

Frequently asked questions

Will the optimized SVG look the same?
In almost all cases yes. SVGO only removes data that does not affect drawing and rewrites paths to the same shape. The one visible risk is rounding: at 1 or 2 decimals, small icons drawn on a large coordinate grid can shift slightly. That is why the tool shows Before and After previews; if they differ, raise the precision and optimize again.
How much smaller will my file get?
It depends on where the SVG came from. Files exported straight from a design tool usually shrink the most, because they carry editor metadata and long numbers. A hand-written or already optimized SVG may barely change. The status line shows the exact size before and after.
My SVG is animated or scripted. Is it safe to optimize?
Tick Keep IDs, classes and element structure first. By default SVGO renames or removes unused IDs, moves rules from a <style> block into style attributes (which removes the class), turns shapes such as <circle> into <path>, merges groups and deletes elements hidden with display:none. Those changes keep the picture identical but break CSS selectors and JavaScript that look for those IDs, classes or elements. With the option ticked, those steps are skipped.
Should I remove width and height?
Only if you size the SVG with CSS. Without width and height, an SVG with a viewBox scales to the width of its container, which is useful for responsive logos and icons. If the SVG has no viewBox, SVGO first adds one from the width and height, so the image keeps its proportions.
Does it compress embedded PNG or JPG images?
No. Some SVGs wrap a bitmap as a base64 data URL inside an <image> element. SVG optimization cannot make that bitmap smaller, and the tool tells you when it finds one. Compress the image separately, or redraw it as vectors.
Can it open .svgz files?
No. An .svgz file is a gzip-compressed SVG. Unzip it to a plain .svg first. On a website, the server can gzip or Brotli-compress the optimized .svg for you, which saves more on top of optimization.
Is my SVG uploaded?
No. The file is read and optimized in your browser with SVGO, which loads from this site the first time you use the tool. Nothing is sent to a server, so it works for unpublished logos and client artwork.

Also try

Related tools that work well with this one: