Home » Developer Tools » SVG Minifier
Paste SVG and get a smaller vector file in seconds, right in your browser.
Last updated 13 November 2026
Your code never leaves your browser. Everything runs locally on your device.
SVG files exported from design tools often carry comments, editor metadata, and needless precision. The SVG Minifier removes that extra weight with the SVGO optimizer, so your vector graphics load faster without changing how they look.
Everything runs in your browser, so your graphics are never uploaded to a server. Paste your SVG, minify it, and copy the result straight into your project.
An SVG minifier is a tool that takes vector code and removes every byte a browser does not need to draw the picture. It deletes comments, collapses extra spaces and line breaks, drops needless precision from numbers, and rewrites simple shapes in shorter form. The picture stays the same and the file gets smaller. This tool runs the SVGO optimizer in your browser with the preset-default set of rules, so nothing is uploaded and nothing leaves your device. Use the small file on your live site and keep your readable original for editing. If you ever need to read a minified file again, the SVG Beautifier formats it back into neat indented code.
Minifying only removes things that do not change how the picture looks. Here is what this tool took out of the test files on this page.
| What is removed | Example from the live test |
|---|---|
| Comments | <!-- a comment --> is deleted |
| Extra spaces and line breaks | Spaced out code collapses to a single line |
| Redundant shapes | <rect> becomes <path d="M10 10h80v80H10z"/> |
| Redundant groups | The <g id="mark"> wrapper in the sample is gone |
| Long color codes | #ff0000 becomes red |
| Editor metadata | Data added by design tools that the picture does not need |
Shapes, colors, and text content are left alone, so your graphic keeps working exactly as before. The viewBox is also kept unless you turn on the remove viewBox option, because it controls how the picture scales.
Here is a small SVG run through the tool, with the exact numbers:
Input, 148 characters:
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> <!-- a comment --> <rect x="10" y="10" width="80" height="80" fill="red" /> </svg>
Output, 110 characters:
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><path fill="red" d="M10 10h80v80H10z"/></svg>
The output is 110 characters, down from 148. That is 38 characters removed, and 38 divided by 148 is 0.2568, so the file is about 26 percent smaller. The comment is gone, the spaces are gone, and the rect is now a shorter path, while the picture itself is unchanged.
Load Sample gives a second example. The built in sample is 252 characters and minifies to 186 characters. That is 66 characters removed, and 66 divided by 252 is 0.2619, so about 26 percent smaller again. In the sample the comment and the group wrapper are gone, the circle and text stay, and #ff0000 becomes red.
The viewBox tells the browser how the drawing maps to the space on the page. With it, an SVG scales cleanly to any width and height, which is why this tool keeps it by default. Turn on Remove viewBox only when your layout sets its own size and you are sure nothing else needs the viewBox to scale the picture. If you remove it and the picture stops scaling, paste the original back in and run the tool again with the option left unchecked.
Most icons and logos on the web keep their viewBox, and the saving from removing it is tiny, often only a few characters. Keep it unless you have a clear reason to drop it.
Multipass runs the optimizer more than once. The first pass shrinks the code, and each later pass looks for new savings in the result of the pass before it. A shape rewritten in the first pass may open up a shorter form in the second pass, so the final file can end up a little smaller than a single pass gives. Turn it on when you want the smallest file you can get and you do not mind the extra work in your browser. The saving is usually small, a few characters on a small file, so leave it off for a quick check and turn it on for the file you publish.
These two tools do opposite jobs. The minifier shrinks SVG code for publishing, while the beautifier expands it into neat indented lines for reading and editing. Minify the file you ship, and beautify the file you need to read. The SVG Beautifier on this site takes minified code and formats it back, so you never lose a readable copy of your work.
Minifying is the first step, not the only step. Serve the file with gzip or Brotli compression turned on, so the server squeezes it while it travels to the browser. Use SVG for icons, logos, and simple drawings, where a vector file is far smaller than a photo file of the same size. Reuse one icon file across many pages instead of pasting the same code into every page, so the browser downloads it once and keeps it. And keep your source files tidy: delete hidden layers and unused shapes in your design tool before you export, because every hidden element adds bytes that the minifier then has to strip out.
Yes, it is completely free with no sign up.
Yes. Minifying removes comments, metadata, and extra whitespace and tidies numeric values. Your graphic keeps the same shapes and colors.
No, not by default. The viewBox is kept so your SVG still scales correctly. Turn on the remove viewBox option only if your layout sets its own size.
CDATA sections are preserved, and namespaces that are actually used are kept. Namespaces declared but never used may be removed.
No. All minifying happens in your browser on your own device, so your graphics never leave your computer.
The tool shows a clear error message and keeps your input untouched, so you can fix the problem and try again.
That depends on how much waste your file holds. A file exported from a design tool, full of comments and extra spacing, shrinks a lot, while a file that is already tidy shrinks only a little. The worked example on this page went from 148 characters to 110 characters, about 26 percent smaller, and the built in sample went from 252 characters to 186 characters, also about 26 percent smaller. Paste your own file into the tool above and the Change figure shows your exact result.
Comments, extra spaces and line breaks, editor metadata, and redundant wrappers are removed, and simple shapes are rewritten in shorter form. The shapes, colors, and text stay the same, and the viewBox is kept unless you turn on the remove viewBox option. The worked example on this page shows each of these changes on a real file.
Multipass runs the optimizer more than once, so each pass can find new savings in the result of the pass before it. It usually saves only a few extra characters, so turn it on for the file you publish and leave it off for a quick check.
Yes. SVGO is also available as a command line tool and a Node package, so you can minify whole folders of SVG files as part of a build step. This page runs the same SVGO optimizer in your browser for one file at a time, with no install and nothing uploaded.
Yes. Minifying only removes spacing, comments, and redundant code, so the drawing is still all there. Paste the minified code into the SVG Beautifier on this site and it formats the code back into neat indented lines you can read and edit.
For more image work, browse all image tools on BotixTech.