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.
Drop a file here, or click to browse
SVG · processed on your device
or press Ctrl+V to paste from your clipboard
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.
- 1DOMParser sanitizes the SVGBefore 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.
- 2DOM-based decimal roundingIf 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.
- 3Regex passes clean the serialized markupXMLSerializer 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.
- 4Gzip size and export formatsThe 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
CSS Minifier & Beautifier
Minify CSS to reduce file size or beautify minified CSS for readability. Instant, in your browser.
GIF Compressor
Make an animated GIF smaller: fit it under a size limit such as Discord's 256 KB emoji or 512 KB sticker, or choose colours, width and frames yourself. Runs in your browser; the GIF is not uploaded.
PDF Compressor
Compress PDF files to reduce their size. Choose a quality level — higher compression means smaller files but lower image fidelity.