Free SVG Optimizer

Optimize and minify SVG files by removing comments, metadata and whitespace.

Preview

About SVG Optimization

SVG files from design tools like Illustrator, Figma, and Inkscape often contain unnecessary metadata, comments, editor-specific attributes, and whitespace that increase file size without affecting the visual output. Optimizing SVGs can reduce file size by 20-60%, improving page load times. This tool performs safe optimizations that preserve the visual appearance of your SVG.

How It Works

  1. Paste or upload SVG: Enter SVG markup directly or upload a .svg file exported from Illustrator, Figma, or Sketch.
  2. Configure optimisation passes: Choose which optimisations to apply, comment removal, metadata stripping, path simplification, and viewBox normalisation.
  3. Optimise: The tool runs the selected passes and shows the file size reduction percentage.
  4. Download or copy: Save the optimised SVG or copy the markup to paste into your code.

Why Optimise SVGs?

SVG files exported from design tools are filled with unnecessary data, editor metadata, inline style declarations with default values, empty groups, redundant transform attributes, and comments. This bloat increases file size without affecting the visual output. SVGO (the industry-standard SVG optimiser used here) can typically reduce SVG file size by 50-80% while maintaining pixel-perfect rendering. Smaller SVGs load faster, inline faster in HTML, and reduce bandwidth, especially important for icon systems with dozens of SVG files loaded per page.

Optimisations Applied

A short history of SVG and SVGO

Scalable Vector Graphics started as a competition between two W3C proposals: Precision Graphics Markup Language (PGML) from Adobe, IBM, Netscape and Sun, and Vector Markup Language (VML) from Microsoft. Both were submitted in 1998; the W3C compromise became SVG, recommended as SVG 1.0 in September 2001. Internet Explorer notoriously refused to ship SVG support until IE9 (2011), while Firefox, Safari, and Opera supported it from the mid-2000s. SVG 1.1 appeared in 2003, with a Second Edition in 2011. SVG Tiny 1.2 targeted mobile devices in 2008. SVG 2 began drafting around 2016 but stalled; today it remains a Candidate Recommendation Draft (last touched in 2018), with browsers shipping pieces individually. Optimisation arrived later. SVGO was created by Kir Belevich (svg-go) and first published on GitHub in October 2012, written in JavaScript. It became the de facto standard, integrated into webpack-loader, Vite, Sketch, Figma export plugins, and the SVGOMG web UI by Jake Archibald (Chrome team) launched in 2015. SVGO 3 (released 2023) modernised the codebase. This tool implements a safe subset of SVGO's most impactful plugins, running entirely in your browser.

What an SVG optimiser actually does

Where SVG optimisation matters

Optimisation mistakes that break SVGs

More frequently asked questions

How much can SVG optimisation actually save?

It depends heavily on the source. Adobe Illustrator exports often shrink by 60-80% on first pass, mostly from metadata, editor namespaces, and decimal-precision reduction. Figma exports are cleaner out of the box (typically 20-40% savings). Hand-written SVG by a developer? Often 5-15%, since there's not much to strip. The Wikipedia logo, an extreme case of Illustrator bloat, went from 39 KB to 11 KB. A typical 24×24 icon from Figma drops from 1.4 KB to 0.6 KB.

When should I inline SVG vs use it as an external file?

Inline (<svg>...</svg> in HTML) for small icons (under 2 KB), critical above-the-fold content, and anywhere you need CSS to style the SVG (e.g. currentColor, hover states, dark mode). External file (<img src="icon.svg"> or CSS background-image) for repeatedly-used identical icons (the browser caches), larger illustrations, content that doesn't need CSS theming. SVG sprite (single file with multiple <symbol> elements, referenced by <use>) was the icon-system pattern of 2014-2019, now largely superseded by inline-svg components in React/Vue/Svelte.

Are there security risks in unoptimised SVG?

Yes. SVG can embed <script> tags and onload, onclick event handlers; user-uploaded SVGs are an XSS vector. SVG can reference external resources via <image href="...">, leaking the viewer's IP. SVG fonts (deprecated but still parseable) historically had buffer overflows. A good optimiser strips <script> and event handlers as part of the cleanup; if you accept user SVG uploads, run them through a hardened sanitiser (DOMPurify with SVG profile) before serving.

Can I optimise SVG using the command line?

Yes. npx svgo input.svg -o output.svg uses the canonical SVGO library. Configure plugins via svgo.config.js. CI integrations: imagemin-svgo in webpack, vite-plugin-svgo, GitHub Action antfu/svg-opt. For batch optimisation: svgo -f ./icons -o ./icons-optimised. The browser tool here is faster for one-offs and works without Node installed.

Is my SVG sent to a server when I optimise here?

No. The optimisation runs entirely in your browser via JavaScript on the SVG markup you paste. Open the Network tab in DevTools while optimising; you'll see zero outbound requests. Safe for proprietary logos, unreleased icon designs, internal corporate SVGs, and anything subject to NDA.

Related Tools