SVG Optimizer: Clean and Shrink SVG Without Changing the Look

Remove what browsers ignore and shorten values, with before and after previews to prove nothing changed.

SVG Optimizer 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 Optimizer works

An SVG optimizer cleans an SVG of everything a browser does not need, shrinking the file while keeping the artwork identical. This one defaults to 3-decimal precision, which is safe for nearly all graphics.

  1. <?xml version="1.0"?><!-- Created with Inkscape --><svg …>

    Parse and measure

    The SVG is read and its size is recorded so each step’s saving can be calculated exactly.

    String length · bytes
  2. Remove what browsers ignore

    The XML declaration, DOCTYPE, metadata, editor attributes and comments are stripped, along with empty defs.

    Regex passes
  3. Shorten the values

    Hex colors such as #ffffff become #fff, rgb() values become hex, and numbers are rounded to 3 decimals.

    Color shortening · precision 3
  4. MetadataNumbersWhitespace

    Collapse whitespace and report

    Whitespace between tags is removed, and a chart shows where every saved byte came from.

    Whitespace · gzip estimate
The four stages of the SVG Optimizer, from your input to the finished file.

Why this optimizer is the safe default

3-decimal precision
Three decimals keep geometry accurate for almost all artwork while still shortening long numbers.
Titles kept
The title and description are kept by default so accessibility is not harmed.
Visible proof
Original and optimized previews sit side by side so you can see they match.

Step by step

SVG Optimizer process

Four steps optimize an SVG. The default settings are safe, so you can often just download the result.

  1. Add your SVG

    Drop a file, paste code or press the sample button.

    Tip: Editor exports shrink the most.

    Drop SVG
  2. Compare the previews

    Look at the Original and Optimized previews. They should look identical.

    Tip: If they differ, raise precision.

    PrecisionCommentsColors
  3. Adjust the options

    Toggle comments, metadata, color shortening and whitespace, and set precision from 0 to off.

    Tip: The savings chart updates with every change.

  4. Download the optimized SVG

    Press Download to save the cleaned file.

    Tip: Rendered locally.

    Download SVGsvg-optimizer.svg

Use the SVG Optimizer

Reference

SVG Optimizer settings / conversion chart

The table lists optimization options and their safety. The chart shows the typical contribution of each.

Typical contribution to the savings (editor-exported SVG)

Typical contribution to the savings (editor-exported SVG)Editor data and metadata: 5/5; Number precision: 4/5; Whitespace: 3/5; Comments: 2/5; Color shortening: 1/5.Editor data and metadata5/5Number precision4/5Whitespace3/5Comments2/5Color shortening1/5
Guide: the exact split for your file is shown in the chart.

At a glance

  • Converts best: Editor data and metadata.
  • Needs the most care: Color shortening.

Guide: the exact split for your file is shown in the chart.

SVG Optimizer options and what they do
OptionWhat it removes or changesVisual risk
Strip metadata and editor dataXML declaration, DOCTYPE, metadata, editor attributesNone
Remove commentsHTML-style commentsNone
Shorten colors#aabbcc to #abc, rgb() to hexNone
Number precisionExtra decimals in coordinatesLow at 2–3 decimals
Collapse whitespaceSpaces and line breaks between tagsNone
Remove title and descAccessibility textNone visually, hurts accessibility

Answers

SVG Optimizer FAQ

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

Will optimizing change how my SVG looks?

With the default settings it should look identical. Compare the Original and Optimized previews to be sure.

What does the optimizer remove?

The XML declaration, DOCTYPE, metadata, editor-specific attributes, comments and extra whitespace, and it shortens colors and rounds numbers.

What number precision is safe?

Three decimals are safe for almost all artwork. Use more for technical drawings and fewer for simple icons.

Does it keep the title and description?

Yes by default, because they help accessibility. You can switch the option on to remove them.

How is this different from the SVG Minifier?

The SVG Minifier is lossless by default and leaves numbers untouched. The optimizer also rounds numbers for extra savings.

Ready to try it?

Your result is one drop away.

Open the SVG Optimizer

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.