Style to attributes (convertStyleToAttrs)
Converts simple CSS declarations on elements into presentational SVG attributes.
What Style to attributes does in SVGO
SVGO applies convertStyleToAttrs as part of its plugin pipeline. In SVGOMG the toggle is labeled Style to attributes (off by default). Optimization runs entirely in your browser — files are not uploaded to a server.
Use the SVGOMG optimizer with Show original to compare before and after. If output looks wrong, disable this plugin first, then re-enable related transforms one at a time.
When to enable
Flat icons where styles map cleanly to fill, stroke, and opacity attributes.
When to disable
Complex CSS (pseudo-classes, descendant selectors) that cannot become attributes.
Watch out for
Off by default; enable only after checking visual parity.
Try it in SVGOMG
- Open svgomg.net and load your SVG (file, paste, or demo).
- Find Style to attributes in the Features panel (
convertStyleToAttrs). - Toggle the plugin and compare the preview; download when satisfied.
SVGO Plugin Guide
Browse the SVGO Plugin Guide or read the full SVG optimization walkthrough on the homepage.