Safe: text redundancy
Whitespace, comments, editor metadata, unused namespace declarations and default attribute values can all go without changing a single rendered pixel.
SVG describes shapes in XML. That changes what "compression" can even mean: there is no quantisation step, no quality dial, and no pixels to approximate — only text to shorten and bytes to gzip.
A raster image is a grid of samples. An SVG is a list of instructions — paths, shapes, transforms, colours — that a renderer executes at whatever resolution it needs.
A logo exported as SVG stays sharp at any size because there is nothing to resample. The same logo exported as a 2000px PNG carries 2000 pixels of detail even when displayed at 32px, which is why icons are the most wasteful thing on most sites.
It also means SVG files can be tiny for simple artwork — a few hundred bytes for a chevron — and surprisingly large for complex ones. A traced photograph, a detailed map or an illustration with thousands of paths can exceed the PNG it replaced, because each path carries coordinates at full precision.
SVG is markup, so the file is dominated by repeated attribute names, redundant whitespace and coordinates with more decimal places than any display can use. Optimisation is therefore a text problem, not a signal-processing one.
Minification is lossless if it only removes redundancy. Everything beyond that is a visual decision.
Gzip or Brotli on the wire is where SVG compression actually happens — often a 3× reduction before any minification.
Vectors are not universally better. Four cases where a raster format wins outright.
SVG belongs to the interface layer, not the photographic one.
Icons, logos, diagrams and simple illustrations should ship as SVG: they are resolution-independent and usually smaller than the PNG they replace. Everything captured by a camera belongs in a raster format, and the choice among those is covered in image formats compared. For the raster side of the same page, see the compression guide.
SVG has no pixels to lose. Minification is lossless if it only removes redundancy; path simplification is not.
Too many paths, embedded raster images, or full-precision coordinates. SVGs that contain a bitmap are the usual culprit.
Substantially — SVG is text with repeated attribute names, which compresses well. Serve it compressed and the on-wire size drops sharply.
Yes, at a chosen resolution. That is a rendering step, and the result is a raster you then have to size deliberately.
Not without sanitising. SVG can contain script and external references; treat it as code.