SVG Optimizer

Paste the code of an SVG icon, logo or illustration and get a smaller file that draws the same picture. The optimizer removes comments, metadata and the extra data design tools add, drops empty groups, rounds the numbers in paths and coordinates to a precision you set, and shows how many bytes it saved.

What you enter

What you get

How it works

  1. Paste your SVG code into the box. Open the .svg file in a text editor and copy everything. It is processed in your browser and never uploaded.
  2. Set the decimal precision. Three is a safe default; lower numbers save more bytes but can shift curves slightly.
  3. Tick the clean-ups you want: remove comments, metadata, editor data from Inkscape, Illustrator or Sketch, empty groups, titles and descriptions, and unused ids.
  4. Read the sizes, then copy the result or download it as an .svg file.

Where the extra weight in an SVG comes from

An SVG file is text, and a freshly exported one is full of things a browser does not need. Editors save the program's own settings, window positions, layer names, grid guides and a metadata block describing the licence. A small icon can carry more bytes of leftovers than of drawing.

The other source is precision. Vector tools keep numbers with many decimals so edits stay exact, but a screen shows a few hundred pixels. Cutting the decimals, and dropping the zeros that a number does not need, is the single biggest saving on most illustrations, because path data is where the numbers are.

How path data is rewritten

A path is a string of commands and numbers, such as M10 20L30 40z. The optimizer reads it the way a browser does, one command and its numbers at a time, including the rule that a command can repeat with more numbers, and the compact arc form where the two flags are single digits that can run into the next number.

It then writes every number back at your precision with the fewest separators: no space is needed before a minus sign or before a second decimal point, as in .5.5. If a path cannot be read cleanly, it is copied unchanged rather than guessed at, so an unusual file loses a few bytes of savings and never its shape.

When to optimize, and when to stop

Optimize icons and logos that ship on every page of a site, because every visitor downloads them. Keep an unoptimized master in your design tool, and treat the optimized copy as a build output. Editing the optimized file by hand is possible but awkward, as the layer names are gone.

Past a point there is little left to save. A cleaned SVG is mostly its path data, and compression on the server shrinks repeated text further. If an image is a photograph traced into thousands of tiny shapes, a raster format such as WebP will usually be smaller than any vector version of it.

Tips

Frequently asked questions

What does an SVG optimizer remove?

Anything that does not change how the picture is drawn: comments, the XML declaration and doctype, metadata blocks, namespaced attributes added by editors such as Inkscape, Illustrator and Sketch, empty groups, unused namespace declarations and white space between tags. Optionally it removes title, description and unused ids.

How does rounding save space?

Design tools often write coordinates with six or more decimals, like 12.345678. Rounding to three decimals writes 12.346, and a trailing zero or leading zero is dropped, so 0.500 becomes .5. A path with hundreds of numbers shrinks noticeably, and the difference is far below what the eye can see at normal sizes.

Will the image look different?

At a sensible precision, no. Rounding to three decimals moves a point by less than a thousandth of a unit. Very small drawings with large scaling, or very low precision such as zero, can show shifted curves, which is why the precision is a setting you control.

What happens to text and styles?

Text, tspan, style and script contents keep their white space exactly, and CSS inside a style element is left unchanged. The tool only rewrites numbers in drawing attributes such as d, points, transform, viewBox, width, height and the coordinates of shapes.

Is my SVG uploaded?

No. The optimizer runs as code in your browser, so your artwork stays on your device.

Why does it say the SVG could not be read?

The code must be well formed XML: every tag closed, attribute values in quotes and one svg element at the top. A missing closing tag or an unquoted value stops the parser.

Related: SVG to PNG converter, Favicon generator, Image compressor.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Free Tools

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap