opyeb SVGForge

Guides · Checklist

A ten-minute SVG size audit you can run before every release

Updated 28 Nov 2026 · 7 min read

An SVG audit does not need a tool with a dashboard. Ten checks, most of them a glance, catch the waste that accumulates in a design system. Run them before a release, and automate the byte count so the checks that need judgement are the only manual part.

The ten checks

  1. Metadata and comments. Search the file for <metadata, <!--, inkscape:, sodipodi:. Any hit is removable.
  2. viewBox present. Every icon should have one. A file with only width and height will not scale and cannot be reused at another size.
  3. Precision. Search for numbers with more than three decimals. On icons, two is enough; more is usually an export artefact.
  4. Empty groups and defs. Look for <g></g> and <defs></defs>. They cost bytes and nothing else.
  5. Duplicate ids. Two icons inlined on one page can share an id and break each other's gradients. Namespace ids per component.
  6. Unused defs. A gradient, filter or clipPath that no element references is dead weight and common in exports.
  7. Raster inside vector. A base64 PNG inside an SVG defeats the purpose. Replace it or accept that the file is an image wrapper.
  8. Text as paths or text. Decided per case: paths are portable but heavy and unsearchable; text is light but font-dependent.
  9. Compression headers. The server sends image/svg+xml with gzip or Brotli and a sensible cache lifetime.
  10. Rendered comparison. Preview at the smallest and largest size you ship, in both themes, before accepting the size saving.
CheckTypical savingRisk
Metadata and comments20–60% of exportsNone
Missing viewBox fixed0 bytesNone, fixes scaling
Precision to 2 decimals5–20%Sub-pixel shift
Empty groups and defs1–5%None
Duplicate id fix0 bytesPrevents a real bug
Unused defs removed2–10%None if truly unreferenced
Raster removed40–95%Needs a vector replacement
Compression enabled50–80% on the wireServer configuration

Automate the numbers, review the judgement

Byte size, presence of a viewBox and the number of decimal places can be checked by a script in a few lines. Whether a removed gradient still resolves, whether the preview looks the same, and whether an id is used by another file need a person. Split the audit that way and it stays cheap enough to run often.

Keep a baseline. Record the size of each icon after optimisation and fail the build when a file grows by more than a set percentage. Growth is usually an accident: a designer re-exported from a different tool, or a filter was added for a one-off state. A baseline turns an invisible drift into a diff someone reviews.

The audit is not a substitute for looking. A file can pass every size check and still render wrong because an id was removed or a transform was dropped. The preview at the shipping size is the last line of defence.

Finally, write down the rules you chose: the precision, the viewBox size, the stroke width and the accessibility default. A checklist that lives only in someone's head is lost when that person is on holiday, and a set that was consistent becomes a set of individual decisions.

Sources

Questions

How big should an icon be?

A single-colour outline icon on a 24 unit grid is usually 300 to 900 bytes after optimisation. A filled icon with several shapes may reach 1.5 KB. If an icon is over 3 KB, something is wrong: a raster image, a filter, or an accidental export of a whole artboard.

How often should I run the audit?

Once per release for a small set, and on every change to the icon library. The audit is cheap; the expensive part is discovering a 200 KB sprite on a production page after a design update. Automate the byte check in CI and let the manual review cover the visual checks.

What is the single most common problem?

A missing viewBox combined with fixed width and height. It makes the icon unable to scale, it trips the accessibility check, and it is usually caused by an exporter setting or by an optimiser plugin that removed the attribute. It is also the easiest to fix.

Run the files through the optimizer and compare the before and after bytes for each one.

Open the optimizer

Written against the W3C SVG specifications, MDN and the React and WCAG documentation; every sample in the examples can be pasted into the optimizer linked above.

Back to the guides