How to export an minified/optimized svg from Inkscape?

I'm using Inkscape to create and manipulate SVGs. Later I use this files in my websites. Unfortunately Inkscape produces a really messy SVG, even I select Plain SVG in the save dialog.

Messy SVG

How can I export a clean, optimized and minified SVG from Inkscape? Like without this metadata and unnecessary transforms?


Solution 1:

In the Save As dialog select the file type to be

Optimized SVG (.svg)

You then get a dialog where you can set which optional SVG elements can excluded.

Solution 2:

The built-in Optimized SVG exporter uses Scour and does a decent job.

However, running the file through SVGOMG usually optimizes the file even further, and has the benefit of a live preview, so you can see the effect the optimizations are having. Worth trying if you're optimizing for the web.