SVG Minifier: Minify SVG Without Losing Anything

Remove whitespace, comments and metadata losslessly to cut SVG file size.

SVG Minifier tool

1Add your SVG

Drop your SVG here, or click to browse Or paste SVG code anywhere on the page. Nothing is uploaded.
No file?

2Adjust the options

3Preview and download

Live preview
sample.svg
Input and output codeView, edit and copy the code
Input SVG code
Output

Under the hood

How SVG Minifier works

An SVG minifier shrinks an SVG by removing whitespace, comments and metadata without changing any numbers. It is lossless by default, so the artwork stays exactly the same.

  1. <svg> <!-- sky --> <rect …/></svg>

    Read the formatted SVG

    The minifier reads indented SVG with spaces, line breaks and comments that browsers do not need.

    String length
  2. Remove comments and metadata

    Comments, the XML declaration, DOCTYPE, metadata and editor data are stripped.

    Regex passes
  3. <svg><rect …/></svg>

    Collapse whitespace

    Spaces and line breaks between tags are removed and repeated spaces are reduced, putting the whole SVG on one line.

    Whitespace collapse
  4. SVGlossless

    Leave the numbers alone

    Number precision is off by default, so coordinates are not touched. You can switch it on for more savings.

    Precision off
The four stages of the SVG Minifier, from your input to the finished file.

Why minify without rounding

Lossless
Nothing visual can change because no numbers are altered.
Predictable
The result is the same artwork, just fewer bytes.
Optional rounding
You can turn on precision if you accept tiny changes.

Step by step

SVG Minifier process

Four steps minify an SVG. Lossless is the default.

  1. Add your SVG

    Drop a file, paste code or press the sample button. The sample is a pretty-printed SVG with comments.

    Tip: Formatted files shrink the most.

    Drop SVG
  2. Check the previews

    Original and minified previews should look identical.

    Tip: They will, unless you round numbers.

    WhitespaceCommentsPrecision
  3. Add rounding if you want

    Lower Number precision for extra savings.

    Tip: Off means lossless.

  4. Download the minified SVG

    Press Download to save it.

    Tip: Rendered locally.

    Download SVGsvg-minifier.svg

Use the SVG Minifier

Reference

SVG Minifier settings / conversion chart

The table compares minifying with other options. The chart shows typical contributions.

Typical contribution of lossless steps

Typical contribution of lossless stepsWhitespace: 5/5; Comments: 3/5; Metadata: 2/5; Color shortening: 1/5.Whitespace5/5Comments3/5Metadata2/5Color shortening1/5
Guide: whitespace is the largest saving in pretty-printed files.

At a glance

  • Converts best: Whitespace.
  • Needs the most care: Color shortening.

Guide: whitespace is the largest saving in pretty-printed files.

SVG Minifier compared with other options
ToolWhitespaceComments and metadataNumbers
SVG Minifier (default)RemovedRemovedUntouched
SVG OptimizerRemovedRemovedRounded to 3 decimals
SVG CompressorRemovedRemovedRounded to 1 decimal
SVG Code FormatterAddedKeptUntouched

Answers

SVG Minifier FAQ

Questions people ask about the SVG Minifier, answered for this specific use case.

Is minifying lossless?

Yes by default. Whitespace, comments and metadata are removed but numbers are not changed.

What is the difference between minifying and optimizing?

Minifying removes only what is unnecessary. The SVG Optimizer also rounds numbers for extra savings.

Can I make the result even smaller?

Yes. Lower Number precision or use the SVG Compressor.

Will it break my SVG?

No. The previews should match, and you can compare them before downloading.

Is my SVG uploaded?

No. Minifying runs in your browser.

Ready to try it?

Your result is one drop away.

Open the SVG Minifier

All converters

Every free converter and SVG tool

43 free tools that run in your browser. Pick a converter below, or search by format or task.