Design tools export SVGs packed with things the browser doesn’t need: XML declarations, editor comments, empty groups, layer names and coordinates with six decimal places. A 4 KB icon can easily be 1.5 KB of useful drawing. Multiply that by the dozens of icons on a typical site and the savings add up, especially when SVGs are inlined into every HTML page.
What gets removed
SVGO applies a long list of safe clean-ups. For example:
- Comments, metadata, the XML declaration and unused IDs such as Illustrator layer names.
- Empty
<defs>and needless<g>groups. - Default values, like
fill-opacity="1". - Long numbers, rounded to the precision you choose.
- Colours shortened, such as
#FFFFFFto#fff, and unneeded attributes likeversionandx="0px"dropped.
Try the sample that loads with the page. It is a typical design-tool export of a tick icon and drops by more than half.
Choosing the precision
Three decimals is a safe default. Simple icons on a 24×24 grid often look identical at one or two decimals, while detailed illustrations or maps may need four. Watch the after preview as you move the slider.
Using the result
- Inline in HTML for icons you want to colour with CSS through
currentColor. - As a file in an
<img>tag for illustrations. - As a data URI in CSS backgrounds. The copied version is URL-encoded rather than Base64, which keeps it smaller.
How to use the SVG Optimizer
- Drop one or more SVG files on the drop zone, or paste SVG code into Original SVG.
- Set the number precision. Lower precision means smaller files, but fine details may shift.
- Tick Remove width/height if you size the icon with CSS.
- Compare the Before and After previews.
- Copy the code, download the file, copy it as a CSS data URI, or download a ZIP of all files.
Features
- Powered by SVGO 4 with its default preset, running entirely in your browser.
- Keeps the viewBox so icons still scale correctly.
- Shows original, optimised and gzip sizes.
- Batch mode for several files, downloaded as one ZIP.
- Safe previews: SVGs are shown as images, so any scripts inside never run.
Frequently asked questions
How much smaller will my SVG get?
Exports from Illustrator, Figma, Inkscape or Sketch often shrink by 30–70%, because they include metadata, editor IDs, default attributes and long decimal numbers. Hand-written or already optimised SVGs shrink much less.
Will optimising change how my SVG looks?
Normally not. The main risk is very low precision on detailed paths, which can make curves shift slightly. Compare the two previews; if something moved, raise the precision by one step.
Why keep the viewBox?
The viewBox lets an SVG scale to any size. Removing it, which some tools do by default, breaks responsive icons. This tool always keeps it.
Are my files uploaded anywhere?
No. SVGO runs as JavaScript in this page. Your files are read and processed on your device and never sent to a server.
Written by Dewan Razib