What is svg optimizer?
SVG files exported from design tools often contain editor data, comments and numbers with many decimals. Cleaning them gives smaller files that load faster and are easier to inline in a page.
This tool applies safe cleanups and shows a live preview, so you can see right away if anything changed.
How to use the svg optimizer
- Paste your SVG code.
- Choose how many decimal places to keep. Two is a good start.
- Press Optimize, check the preview and copy the result.
How the svg optimizer works
The tool removes the XML prolog, doctype, comments, metadata, editor specific tags and attributes, data attributes and extra whitespace. Long decimal numbers are rounded to the number of places you choose.
Worked example
Common uses of the svg optimizer
- Shrinking icons before inlining them in HTML.
- Cleaning SVG logos exported from Illustrator or Inkscape.
- Reducing page weight for faster loading.
- Removing hidden metadata before sharing files.
- Preparing SVG for use in CSS.
Tips and common mistakes
Keep the viewBox attribute. It is what lets the SVG scale correctly.
For complex artwork, compare the preview with the original at a large size.
Background: what to know before you rely on it
SVG is a text format, so every extra character counts. Design apps add many things that browsers never use, such as editor names, layer data and long decimals. Removing these can cut file size by half or more. Specialized tools such as SVGO go further, merging paths and converting shapes, and are worth using in a build process. Because SVG can contain scripts, only use files from sources you trust and never paste untrusted SVG into a live page without sanitizing it. Also remember that for large photographic images SVG is the wrong format, since raster formats are smaller for them.
Private, free and fast
This tool runs entirely in your browser. What you type or choose is not uploaded to a server and is not saved after you close the page, which keeps it fast and private. It is free to use as often as you like. See more in all developer tools, or browse the full list of tools.
Frequently asked questions
Will optimizing change my image?
Not visibly at two decimals for most icons. Check the preview.
Does it merge paths?
No. It only removes non essential data and rounds numbers.
Is it safe for animations?
Check carefully. Simple cleanup should not break them.
Is my SVG uploaded?
No.
Related tools
CSS Minifier
Paste your CSS and the minifier removes comments and extra whitespace to make the file smaller, with the...
Developer ToolsHTML Minifier
Paste your HTML and the minifier removes comments and extra whitespace between tags to reduce file size...
Image ToolsImage Compressor and Resizer
Choose an image, set a maximum width, quality and format, and download a smaller file. The image never...
Image ToolsImage to Base64 Converter
Choose an image and get its Base64 data URL, plus ready to paste HTML and CSS snippets. The file never...
Developer ToolsJSON Formatter and Validator
Paste your JSON and the tool checks that it is valid, then formats it with indentation or compresses it...
Developer ToolsBase64 Encoder and Decoder
Base64 turns text or bytes into a safe string of letters and numbers. Choose encode or decode, paste...
Results are for information and education. For legal, financial, medical or security decisions, check with a qualified professional. Do not paste live secrets into any website.