Optimize SVG files in your browser

Paste SVG markup or open a .svg file, remove editor leftovers, trim decimal precision, and compare sizes — all without uploading your artwork.

Paste markup or open a file. Everything is processed locally in this tab.

Decimal places kept in path coordinates. 2 is a good default; lower values save more but can distort thin strokes and small icons.

Repeats the plugin chain while the output keeps shrinking. Slower on large files, often a few percent smaller.

Why SVG files get heavy, and what optimization removes

SVG is text, and text surprises people: a small icon can weigh more than a photograph. The reason is rarely the drawing itself. Design tools export their working state along with the artwork. Figma, Illustrator and Inkscape write layer names, hidden groups, XML comments, empty defs blocks, unused gradients, clip paths that clip nothing, and private namespaced attributes such as inkscape:label or sodipodi:nodetypes. Coordinate strings keep six or seven decimal places because the editor stores whatever the canvas produced. Colours repeat as full hex values. Elements keep width, height, fill and stroke attributes even when a parent already sets them. Auto-traced artwork adds thousands of short path segments, each with its own rounding noise. None of this changes what you see, and every byte of it still has to be downloaded, parsed and held in memory.

SVGO is not an image converter. It does not rasterise the drawing, resample it, or approximate it with a different format. It parses the document into a syntax tree, walks that tree with a list of plugins, and serialises the surviving nodes back to XML. Each plugin has one job: remove comments, drop metadata, delete editor namespaces, merge duplicate style declarations, shorten colour notation, round numbers, convert simple shapes to paths, collapse groups whose attributes add nothing, join adjacent paths that share a style. Because the changes are structural rather than visual, text stays selectable text, gradients stay gradients, and strokes keep their geometry unless a plugin is explicitly allowed to approximate. The result is still an ordinary SVG document; nothing about the format changes.

Precision is the setting that most directly trades bytes for fidelity. Path data is a list of commands and coordinates, and an export may contain values such as 12.345678. Every digit costs a byte, and long decimals also stop two nearly identical segments from being recognised as duplicates. Rounding to two decimals usually saves a visible amount and is invisible at icon sizes. Rounding to one decimal, or to integers, can suit simple geometric marks on a large canvas, but it distorts small viewBoxes, thin strokes and long curves: a 0.4 px shift is imperceptible on a 512 px illustration and obvious on a 16 px favicon. The optimiser also rewrites paths — switching between absolute and relative commands, deleting redundant moves, occasionally simplifying curves — so precision is a ceiling rather than a promise that geometry is untouched. Preview the output at the size where it will really appear, and compare it with the original whenever the artwork matters.

Several categories of markup are almost always safe to remove. Comments and metadata carry authoring information for humans and tools, not rendering instructions. Editor namespaces only matter if you reopen the file in the same editor. Empty groups, empty text nodes and definitions that nothing references can go. Default attribute values can be dropped when the renderer would assume them anyway. Repeated styles can be merged into a class or lifted to a parent. Colours can be shortened from #ffffff to #fff, and numbers can lose leading or trailing zeros. More aggressive plugins — merging paths, collapsing groups, converting shapes to paths — are visually safe but change the editing structure. This page keeps element ids intact on purpose: external CSS, JavaScript and SMIL animations often target them by name, and renaming ids inside the tool would silently break code outside the file.

Optimisation and transfer compression solve different problems, and their percentages do not add up. An SVG is repetitive text, so gzip typically removes 60–80% of it and Brotli a little more. If you optimise first, the file reaching the compressor is smaller, but it compresses slightly less efficiently because the easy repetition is already gone. The absolute transferred size still drops. Do not advertise a 70% minification and a 75% gzip saving as a combined 145%; benchmark the final bytes on the wire. Serve .svg files with Content-Encoding and a long cache lifetime, and prefer external files for icons reused across pages so the browser can cache them. Inlining a small icon into HTML makes it part of the document, where it is compressed with the page but cannot be cached separately. Avoid base64 unless you must: base64 adds roughly a third to the size before compression.

Some documents should not be pushed to the limit. SMIL animations reference targets by id; CSS animations may target classes or ids from an external stylesheet; filters and masks reference primitives by id inside defs. Collapsing groups or merging paths can break those relationships even when the rendered result looks correct on first load, because the breakage appears only when the animation starts or a media query switches styling. Files that contain foreignObject, embedded raster images, scripts or event handler attributes deserve manual review. Accessibility markup is another boundary: title, desc, role and aria-* attributes exist for assistive technology and search engines, and they should not be deleted to save a few bytes. The default preset used here leaves them in place. Finally, remember that optimisation is lossy in a narrow sense: geometry may be rounded and groups may disappear. Keep the editable source in version control before replacing production assets.

The tool runs entirely in your browser. There is no upload step, no server queue, no account, and no file retention. Your SVG is read with the File API, optimised by the browser build of SVGO inside the tab, and turned into a local Blob for preview and download. Once the page has loaded, the work continues even if you go offline; the only network requests are the page and the optimiser chunk, which the browser caches. That matters for client work, internal diagrams and anything under an NDA: nothing leaves the machine, and nothing is logged by us.

A practical workflow is short. Keep the original, optimise a copy, preview at the target size, and check three things: text still renders, gradients and filters still appear, and any ids referenced by surrounding code still exist. Compare the byte counts, then run the result through the compressor your server actually uses. If the saving is small, the file was probably already clean, and further gains would have to come from lowering precision, removing assets or switching formats. If the output grows — which happens with tiny hand-written icons — keep the original; an optimiser is not obliged to win every time.

How to use the SVG optimizer

  1. Paste the full SVG markup into the source box, or click “Open .svg file” and pick a file from your device.
  2. Leave path precision at 2 for most icons. Raise it to 3 or 4 when the artwork has fine curves or very small details.
  3. Tick “Run multiple passes” if you want the plugin chain repeated until the output stops shrinking.
  4. Click “Optimize SVG” and wait for the status line; large files with thousands of nodes can take a moment.
  5. Compare the original, optimized and saved figures to judge whether the change is worth it.
  6. Check the preview, and open the result at its final size if you need to confirm gradients, text or thin strokes.
  7. Copy the markup or download the file, then keep the original source in case you need to edit it later.

Frequently asked questions

Will optimization change how the SVG looks?

Normally no. The default preset removes information that renderers ignore, such as comments, editor attributes and unused definitions. Geometry is rounded according to the precision you choose, which is a real but usually invisible change. With precision 2 on a typical icon, the difference is far below one device pixel. At precision 0, or on artwork with very thin strokes and a small viewBox, you may see slightly flattened curves, so compare the preview before shipping.

Which precision should I choose?

Start at 2. It is the usual compromise for interface icons and logos and keeps files small without visible damage. Choose 3 or 4 for detailed illustrations, maps or line art that will be displayed large. Choose 1 only for simple geometric shapes that you have checked at their final size. Precision 0 rounds coordinates aggressively and is rarely appropriate unless the drawing is deliberately blocky.

Can I optimize several files at once?

This page works on one document at a time, which keeps the preview and the byte comparison unambiguous. For batches, run the same settings through the SVGO command line or a small script in your build; the plugin preset used here is the same one, so results are comparable. Processing dozens of files with a script also lets you record the before and after sizes in a log.

Can animated SVGs be optimized?

Yes, but review the result carefully. SMIL elements such as animate and animateTransform are preserved, and so are ids in this tool, which protects most animation targets. Group collapsing and path merging can still change the structure that CSS selectors rely on, especially selectors like :nth-child or descendant combinators. Load the optimized file in a browser and watch one full animation cycle instead of judging from a static preview.

Can I still edit the optimized file in a design tool?

Usually yes, but the file becomes less convenient to edit. Layers may be flattened, groups collapsed and simple shapes converted to paths, so Illustrator or Figma will show fewer named objects and more raw curves. That is why you should keep the original export as your working copy and treat the optimized file as a build artifact. Never overwrite the only copy of an editable source with an optimized version.

Why did my file only shrink a little?

Files that were already exported with “minify” enabled, or produced by a generator rather than a drawing tool, contain little removable metadata. Very small icons can even grow by a few bytes because SVG requires a namespace declaration and the optimizer cannot compress below that floor. In that case the original is already close to optimal, and the remaining gain would require lowering precision or simplifying the artwork itself.

Are my files uploaded to a server?

No. The SVG is read locally with the File API, optimized in the tab by the browser build of SVGO, and never sent anywhere. There is no account, no processing queue and no retention policy to worry about, because no copy reaches us. You can verify this in the network panel of your browser developer tools while the tool runs.

Is this the same as gzip or Brotli?

No. SVGO changes the document itself, while gzip and Brotli compress the bytes for transport and let the browser reconstruct the exact original. They complement each other, but their savings do not add linearly. An optimized file often compresses slightly less efficiently because repetition has already been removed, yet the final transfer size is still smaller. Configure compression on your server as well; leaving SVG uncompressed wastes far more than any minifier can recover.

Will title, desc or ARIA attributes be removed?

The default preset keeps title and desc, and it does not strip role or aria-* attributes. Empty or useless descriptions may be dropped, which is why you should check accessible names after optimizing. If the SVG conveys information, keep a title and reference it with aria-labelledby where appropriate. Removing accessibility markup to save a few bytes is a poor trade, and it is not something this tool does by default.

Does the optimizer work offline?

After the page and the optimizer bundle have loaded once, the conversion itself needs no network. You can keep working in a tab with the connection disabled. Reloading the page offline depends on the browser cache and on whether the site has been installed as an app, so treat offline use as a convenience rather than a guarantee.