Skip to main content

Free SVG Optimizer & Minifier

Strip metadata, collapse whitespace, and round decimals to dramatically shrink SVG file size — typical reductions of 30-70%. Visual preview verifies nothing breaks.

Works offline once loaded

Drop a file here, or click to browse

SVG · processed on your device

or press Ctrl+V to paste from your clipboard

Browse files
— or paste SVG below —

Your files never leave your device. All processing happens locally in your browser.

Common uses

  • Optimize SVG Icons for ProductionStrip unnecessary metadata from icon SVGs before shipping — typical reduction of 50-80%.
  • Optimize Brand Logo SVGsReduce SVG logo file size for fast website loading without sacrificing quality.
  • Optimize Illustrations and Hero SVGsFor larger illustrations (heroes, decorative graphics), optimization can shave 30-70% off file size.
  • Reduce JavaScript Bundle SizeWhen SVGs are imported as React components or inlined in code, optimizing them shrinks your JS bundle.
  • Clean Up Figma / Sketch SVG ExportsFigma and Sketch SVG exports include extensive metadata. Strip it before using in production.

How It Works

This tool reduces SVG file size using a hand-written optimizer that runs entirely in your browser — no libraries, no server. It combines two passes: the browser's built-in DOMParser/XMLSerializer for attribute-level precision work, and targeted regex substitutions for comment stripping, metadata removal, and whitespace collapsing.

  1. 1
    DOMParser sanitizes the SVG
    Before any optimization, the browser's DOMParser reads the SVG as XML and walks every element. Script tags, event handlers (any on* attribute), animation elements, and external URL references are removed unconditionally — this runs regardless of which optimization options you choose.
  2. 2
    DOM-based decimal rounding
    If decimal rounding is enabled, the optimizer walks the parsed DOM a second time and applies rounding only to known numeric attributes (path d data, coordinates, transform values, stroke widths, etc.), using a regex that matches individual floating-point numbers without corrupting concatenated path values like .5.5.
  3. 3
    Regex passes clean the serialized markup
    XMLSerializer produces normalized XML, then targeted string replacements strip HTML comments, Inkscape/Sodipodi editor metadata, the XML declaration, redundant default attributes (like version="1.1"), and inter-tag whitespace — each pass scoped narrowly so text node content is never touched.
  4. 4
    Gzip size and export formats
    The browser's CompressionStream API computes the real gzip sizes of both input and output, since that is what actually determines transfer cost on the web. The optimized SVG can be downloaded, copied as raw SVG, converted to React JSX-ready camelCase attributes, or encoded as a CSS data URI — all conversions happen locally.

Your SVG is read and processed entirely within your browser tab — the file bytes never leave your device.

Related Tools

Frequently Asked Questions