SVG Compressor

Shrink SVG file size by rounding coordinate and path precision and shortening hex colors — adjustable precision with a live size comparison. Runs entirely in your browser.

Decimal precision:

Invalid SVG — check your markup and try again.

Where does SVG file size actually go?

Design tools routinely export coordinates with 6–10 decimal places — M12.345678 50.123456 — even though browsers render at whole-pixel resolution on most screens. Across a path with hundreds of points, that extra precision adds up to a meaningful fraction of the file. Six-digit hex colors with repeated digit pairs, like #ffcc00, can also be written in their three-digit shorthand #fc0 with no change in the rendered color.

What gets compressed

  • Coordinates and path data d, points, x/y, cx/cy/r, and transform values rounded to your chosen precision.
  • Opacity and stroke values opacity, stroke-width, and related attributes rounded the same way.
  • Six-digit hex colors — shortened to three digits whenever each channel is a repeated pair, e.g. #003366 #036.

Frequently Asked Questions

What does the SVG Compressor do differently from the Optimizer?+

The SVG Optimizer removes structural cruft — comments, metadata, redundant attributes — without touching the numbers in your markup. The Compressor goes further: it rounds coordinate, path, and opacity values to a chosen number of decimal places and shortens six-digit hex colors like #ffcc00 to #fc0 where possible. These changes are technically lossy — the geometry shifts by a fraction of a pixel — but at 1–2 decimals the difference is invisible.

Will reducing precision change how my SVG looks?+

At the default of 2 decimal places, coordinate shifts are smaller than a hundredth of a pixel at typical display sizes — completely invisible. Lower precision (0–1 decimals) can introduce tiny visible artifacts in complex illustrations or when the SVG is displayed very large; the live preview updates with every change so you can confirm the result looks right before copying.

What precision should I choose?+

2 decimal places is a safe default for icons and UI graphics — most design tools export far more precision than is ever visible. Drop to 1 or 0 for simple geometric shapes where you want the smallest possible file. Keep 3 for large illustrations, maps, or charts where small cumulative rounding errors could become noticeable when zoomed in.

Is my SVG sent to a server?+

No. Parsing, rounding, and color shortening all happen in your browser using the built-in DOMParser and XMLSerializer. Your SVG markup never leaves your device.

How to use

  • Paste your SVG markup and choose a decimal precision — 2 is a safe default.
  • Coordinates, path data, and opacity values are rounded; six-digit hex colors are shortened where possible (e.g. #ffcc00#fc0).
  • Check the size comparison, then copy the compressed output.