svgcleaner
Lossless SVG file optimizer
TLDR
Clean SVG
SYNOPSIS
svgcleaner [--preset preset] [options] input output
DESCRIPTION
svgcleaner performs lossless optimization of SVG files, reducing file size without altering their visual appearance. It removes unnecessary metadata, editor artifacts, unused definitions, and redundant attributes that bloat SVG files exported from graphic editors.
The tool simplifies path data, optimizes geometry, merges compatible elements, and removes empty groups and containers. Multiple optimization passes can be applied for maximum size reduction. Optimization presets allow choosing between conservative and aggressive cleaning levels.
Written in Rust for performance, svgcleaner is particularly effective at cleaning SVGs produced by editors like Inkscape, Adobe Illustrator, and Sketch, which often embed substantial editor-specific metadata and redundant styling information.
PARAMETERS
--preset NAME
Optimization preset.--keep-named-ids
Preserve IDs.--indent N
Indentation spaces.-q
Quiet mode.--multipass
Multiple optimization passes.
CAVEATS
May break complex SVGs. Test output. Rust written.
HISTORY
svgcleaner was created as a lossless SVG optimizer, reducing file size without affecting visual appearance.
