← All guides

How to reduce an SVG file while checking that the drawing still works

Open SVG Optimizer, inspect the optimised preview and download the result. Compare its bytes, dimensions and drawing with the original, then test it in the destination layout. A smaller SVG is useful only when the required appearance and references still work; keep the original for another attempt.

Define what the destination asset must retain

You want a lighter vector illustration for a page or document, while keeping its shapes, colours and layout. Start with an authorised standalone SVG and note its declared width, height and viewBox. Keep the source so an aggressive setting does not become your only copy.

The viewBox describes the drawing's coordinate rectangle; declared pixel dimensions describe a display size. Optimisation and resizing are separate operations. A file becoming shorter does not establish that it still fits the same place in the destination page.

Optimise and check the actual downloaded SVG

Change one option at a time when diagnosing a difference. A preview that looks correct as a standalone image does not exercise every way a website might reference elements inside the SVG.

  1. Open SVG Optimizer and choose the source SVG. Wait for the before and after previews and the byte readout.
  2. For the public example, retain the default optimisation switches, numeric precision 3 and multiple passes. Inspect the resulting shapes before changing more options.
  3. Download the optimised SVG. Reopen it in SVG Viewer or another suitable viewer and check its dimensions, viewBox and drawing.
  4. Compare small details, gradient fills, thin lines and clipped edges with the source at the intended display size and when enlarged.
  5. Test the downloaded asset in the actual destination layout before replacing the original reference. Keep a usable copy of both files until that integration is checked.

Verify the 593-byte public drawing

Our authored illustration declares 360 × 240 pixels and a viewBox of 0 0 300 200. The saved optimised SVG is 478 bytes, compared with 593 bytes for the source: 115 fewer bytes. The declared size and viewBox remain the same.

We rendered both files at 360 × 240 in the recorded browser and compared decoded pixels. Every channel matched for this sample. That is a useful controlled result, not a guarantee that every illustration, precision setting or renderer produces an identical picture.

SVGBytesDeclared pixelsviewBox
Source593360 × 2400 0 300 200
Optimized478360 × 2400 0 300 200
Optimized public geometric SVG rendered at the same dimensions as its source

Check precision and references outside the preview

Rounding coordinates more aggressively can alter small geometric details. If a fine curve or thin gap changes, return to the original, use a less aggressive setting and inspect the new export. Zooming in can help find a change, but also check the size at which people will actually see the asset.

Cleaning IDs can change names used by code or styles outside the SVG. Internal references in a standalone sample do not test those external dependencies. If the destination refers to specific IDs, review that integration and the relevant cleanup option before approving the replacement.

When fewer bytes are not a successful result

A tiny or already-optimised SVG may offer little saving, and another export can be larger. Check the actual result rather than assuming the optimiser must always reduce bytes. Keep the original when the change brings no useful benefit or alters required behaviour.

External images, fonts and destination styles still need their own availability checks; optimisation is not a packaging step for every dependency. A PNG export is a separate raster deliverable and loses the SVG's scalable structure. This guide checks one standalone drawing, not every possible SVG feature or embedding method.

Further reading