SVG Optimizer
SVG Optimizer minifies SVG code locally in your browser after validating that the input is SVG/XML with an <svg> root.
Use this SVG minifier and SVG compressor to optimize SVG online, compare original and optimized byte sizes, copy the minified SVG, or download a smaller .svg file.

Upload an SVG
Select or drop one .svg file up to 2 MB. The file is read as text and optimized locally in your browser.
Empty input, invalid XML, non-SVG roots, unsupported files, and locked previews do not consume a use. A use is recorded only after valid optimized SVG output is produced.
Paste SVG code
Optimized SVG appears here
Paste SVG text or upload a .svg file to get minified markup, size savings, copy actions, and a local download.
This tool minifies SVG text and avoids injecting untrusted SVG markup into the page. It does not prove that an unknown SVG is safe to embed as trusted HTML.
Optimize and Minify SVG Code
What this SVG optimizer changes
The tool validates the pasted text or selected .svg file as SVG/XML, removes XML comments, trims XML declarations and doctypes, collapses whitespace between tags, and tightens simple tag spacing. It is designed for quick copy-ready SVG minification rather than a full build-pipeline configuration system.
After a valid optimization, the result shows original size, optimized size, bytes saved, and percent saved using UTF-8 byte counts. The optimized SVG text can be copied directly or downloaded as a new .svg file.
- Paste SVG markup when you are cleaning an inline icon or exported snippet.
- Upload a .svg file when you want a smaller downloadable asset.
- Copy-all includes labeled size metrics plus the optimized SVG text.
- Empty input, invalid XML, a missing <svg> root, and unsupported files do not count as successful uses.
Browser-local file handling
SVG files can contain private labels, internal paths, comments, editor metadata, and design-system naming conventions. This tool reads the selected file in the browser and does not add a server route for optimization.
The upload path uses the browser File API to read text from one selected .svg file. The paste path works the same way after text is entered, so both workflows keep the SVG code on the device while the result is prepared.
- Supported upload: .svg files and browser-reported SVG/XML MIME types.
- The optimized output is plain text until you copy or download it.
- The download button creates a local Blob URL for the optimized SVG.
- Large or malformed XML should be fixed in the source editor before retrying.
Optimization is not sanitization
Minifying SVG can make markup smaller, but it does not make untrusted SVG safe. SVG may still contain links, external references, scripts, event attributes, animation, style rules, or other content depending on the original file and how it is later embedded.
Do not paste or publish optimized SVG from an unknown source as trusted HTML. If security is the goal, use a dedicated SVG sanitizer and review the embedding context, content security policy, and image delivery method.
- This tool does not execute or inject the SVG into the page as inline markup.
- No visual preview is required to produce the optimized text result.
- Treat the output as smaller SVG code, not as a security-reviewed asset.
- Review accessibility labels and title text before removing data from important icons.
When to use a full SVGO workflow
This page is best for one-off optimize SVG online and minify SVG online tasks. For a repository, icon library, or design system, a configured SVGO step can enforce the same rules across every SVG during build or CI.
Use a full SVG optimizer configuration when you need multipass optimization, plugin-level control, precision settings, batch folder processing, or team-reviewed rules for removing metadata, dimensions, fills, IDs, or accessibility elements.
- Browser tool: fast paste, upload, copy, and download for one SVG at a time.
- Build tool: repeatable automation across many files.
- Designer review: needed when optimization might change rendering or accessibility.
- Security review: separate from size optimization.