How to Compress an SVG File: Precision-Editing Vectors

An SVG is plain text, which means it compresses extremely well and also means design tools write enormous amounts of it that no browser ever needs. Most exported icons can lose half their bytes without a single visible change.

What Is Actually in the File

  • Editor metadata — generator comments, guides, sliced IDs, unused definitions.
  • Precision you cannot see — coordinates with eight decimal places on a 24 px icon.
  • Redundant path commands — separate segments where one curve would do.
  • Duplicate styles repeated per element instead of once.

Step 1: Round the Coordinates

Two decimal places are visually identical to six at any normal icon size, and dropping to one is usually fine. On a detailed illustration, coordinate precision alone can be a third of the file.

Step 2: Strip Metadata and Collapse Structure

Remove editor cruft, merge groups that add nothing, and delete unused gradients, symbols, and clip paths. SVG Compressor performs this class of cleanup in one pass and preserves rendering exactly.

Step 3: Convert to Paths Only When You Must

Outlined text is portable but much larger, and it cannot be translated or styled later. Keep text as text if the SVG is inline in a page with the font available; convert to paths only for standalone assets you send to other people.

Step 4: Let the Server Compress It

SVG is text, so gzip and brotli are dramatic: a 20KB icon commonly transfers at 4-7KB. Optimize the file first, then confirm your host is serving it compressed. Skipping the server-side step is the most common way sites ship full-size SVG to every visitor.

Realistic Savings

SourceTypical ExportAfter Cleanup
Simple UI icon3-8 KB0.6-2 KB
Multi-colour logo15-40 KB5-14 KB
Detailed illustration200-900 KB70-300 KB
Traced raster artwork1-6 MBBarely helps; see below

When SVG Is the Wrong Answer

Anything traced from a photograph produces thousands of path nodes, and no amount of cleanup makes that better than a JPEG or WebP of the same picture. SVG is for logos, icons, and flat illustrations — not for images that were ever rasters.

Conclusion

Round coordinates to two decimals, strip editor metadata, keep text as text, and confirm the server gzips it. Traced photo art should be a raster instead.

← Back to Blog