Skip to main content

SVG optimizer

Reduce SVG file size with path rounding, color conversion, and cleanup of editor data, comments, and unused definitions.
Optimization preset
Choose a ready-made preset or adjust the options by hand

Balanced optimizations with path and color rounding. Recommended for most SVGs.

Optimization options
Configure each optimization

0 Bytes

0 Bytes
Optimizations in detail

Basic cleanup

Removes the XML declaration, DOCTYPE, comments, metadata, and editor data.

Path rounding

Rounds numbers in paths to fewer decimal places (1.234567 to 1.23).

Color shortening

Converts RGB and HSL to hex and uses the short notation (#aabbcc to #abc).

Advanced

Removes unused definitions, shortens IDs, and cleans up empty containers.

How to compress an SVG in four steps

  1. Upload an .svg file or paste the SVG code into the input field.
  2. Choose a preset: 'Safe', 'Standard (recommended)', or 'Aggressive'.
  3. Read the size before and after optimizing. The tool also shows the savings in percent.
  4. Check the preview, optionally compared with the original. Then copy the code or download the file. The file name gets the suffix '-optimized'.

You can turn each option on or off on its own. How much you save depends on the SVG. An export from a design tool usually leaves more room than a file that was already cleaned up by hand.

What the three presets do

PresetWhat happens
SafeRemoves the XML declaration, DOCTYPE, comments, metadata, editor data (for example from Inkscape, Illustrator, and Sketch), empty attributes, extra whitespace, and opacity values of 1. Paths and colors stay unchanged.
StandardAlso rounds numbers in paths to two decimal places (more with a small viewBox) and in transforms to at least three. rgb() and hsl() colors become hex, and hex values like #aabbcc become #abc. It also removes unused definitions and empty containers.
AggressiveLike Standard, but with one decimal place. It also shortens IDs to a0, a1, and so on, and removes hidden elements, meaning those with display:none or opacity="0".

You set the decimal places yourself with a slider. If edges look rough after optimizing, raise the value.

When the optimizer leaves things alone

  • The tool doesn't round paths with arc commands (a or A), because their parameters can't be separated safely.
  • If your SVG contains a style element, a script, class attributes, or animations, the optimizer leaves ID shortening, unused definitions, empty containers, hidden elements, and opacity values alone. It can't tell for sure what refers to them.
  • IDs that are referenced through url(#...), href, or aria-labelledby are kept.
  • Named colors such as 'red' stay as they are. Only rgb() and hsl() values are converted.

Check before you use the result

The option 'Remove metadata' also deletes the title and desc elements. If you use them as alternative text for screen readers, turn the option off. A title or desc that is referenced through aria-labelledby is kept.

The optimizer reads your SVG as strict XML. If the code isn't well-formed, the tool shows an error message and offers no download. Compare the result with the original in the preview before you put the file on your website.

Frequently asked questions

Everything about SVG optimization
What does the SVG optimizer do?
It removes unneeded data from SVG files, such as metadata, comments, and editor-specific attributes, and tidies the structure. It can also round numbers in paths, shorten colors, and remove unused definitions.
Which optimizations does it apply?
It removes the XML declaration, DOCTYPE, comments, metadata, and editor data, including namespace declarations that are no longer needed, such as xmlns:inkscape. It rounds path data to a set number of decimal places and transforms to at least three (scale and matrix values never become 0), converts rgb() and hsl() colors to hex, shortens hex colors like #aabbcc to #abc, and removes extra whitespace. If the SVG has no xmlns attribute, the tool adds it so the image also displays outside HTML. Each option can be turned on or off.
What is path optimization?
Path optimization shortens the decimal places in paths, for example from 1.234567 to 1.23. For SVGs with a small viewBox (edge length below 10), the tool automatically keeps extra decimal places so the shape isn't visibly distorted. The tool leaves paths with arc commands unchanged.
Are my SVG files uploaded to a server?
No. The optimization runs in your browser. The tool doesn't send your SVG to a server and doesn't store it.
How much file size can I save?
That depends heavily on the SVG. Files exported from design tools like Illustrator or Inkscape often contain a lot of metadata and comments, so they can shrink noticeably. For SVGs that are already optimized, the effect is small. The tool shows the exact savings after each run.
Can optimization damage my SVG?
The 'Safe' preset only removes data and doesn't touch paths or colors. With few decimal places, rounding can lose fine detail. Use the preview to compare with the original and adjust the settings if needed.
Which preset should I choose?
"Safe" removes only ballast such as comments, metadata, and editor data, and changes neither paths nor colors. "Standard" also rounds numbers and converts colors, and suits most SVGs. "Aggressive" also shortens IDs and removes hidden elements. If you use the SVG with CSS or JavaScript and access IDs, don't choose "Aggressive". As soon as you change an option or the slider yourself, no preset matches anymore and none is highlighted.
What happens to title and desc for screen readers?
With the option "Remove metadata", the tool also deletes the title and desc elements, unless aria-labelledby or aria-describedby references them. If you use them as alternative text, turn the option off or add a reference. The tool doesn't add descriptions.
How is this different from SVGO?
SVGO is the established command-line tool with many plugins. This tool works directly in the browser and covers only a small part of what SVGO does. It removes comments, metadata, and editor data, rounds numbers in paths and transforms, converts colors, removes unused definitions and empty containers, and shortens IDs. It doesn't merge paths, convert shapes to paths, or move attributes. For complex cases and build processes, SVGO is the better choice.

Related tools

All tools

Changelog

Latest updates and improvements to the SVG optimizer
v2.2.0

November 20, 2026

Preset display, rounding, and namespaces

  • • Added this English version of the tool
  • • Fixed: The preset selection no longer jumps back to "Standard" when you change an option. It shows the matching preset or, for custom settings, none
  • • Fixed: Transforms are rounded to at least three decimal places, and scale and matrix values never become 0
  • • Fixed: For SVGs with a small viewBox, the path optimizer rounds with extra decimal places and no longer distorts the shape
  • • Fixed: "Remove editor data" also deletes the no longer needed declarations xmlns:inkscape and xmlns:sodipodi
  • • Fixed: SVGs without xmlns are displayed in the preview, and the output contains the attribute. An <svg inside a comment before the root element is no longer changed
  • • The answer on how this differs from SVGO now describes exactly what the tool does. New in the FAQ: choosing a preset and title/desc for screen readers
v2.1.0

November 17, 2026

Option for default opacity values

  • • The option now reads 'Remove opacity 1' and removes opacity, stop-opacity, and flood-opacity when the value is 1. Inherited properties stay untouched
  • • Removed the option 'Merge styles' from the presets because it was never evaluated
  • • Added a guide with instructions and use cases below the tool
  • • Added related tools at the end of the page
v2.0.0

December 20, 2025

SVGO-like optimizations

  • • Path optimization with configurable decimal places
  • • Color conversion (RGB/HSL to hex, short hex)
  • • Transform optimization
  • • Removal of unused definitions
  • • ID cleanup
  • • Preview comparison (original vs. optimized)
  • • Preset selection (Safe, Standard, Aggressive)
Show older versions
v1.0.0

December 17, 2025

Launch

  • • Removal of XML declarations
  • • Removal of comments
  • • Removal of metadata
  • • Removal of editor attributes
  • • Whitespace cleanup
  • • SVG preview