How to compress an SVG
- Choose or drop .svg files — as many as you like — or press Paste SVG code and paste the markup. Pasting a whole ChatGPT, Claude or Gemini reply works too; the SVG is pulled out of it.
- Leave the Balanced preset on, or pick Safe (keeps IDs, 3 decimals) for SVGs used with CSS or animation, or Maximum for the smallest file.
- Check the two previews and the pixel match line. If small details moved, raise the decimal places by one.
- Download SVG, Copy code to paste into HTML, or download All as a ZIP.
What compressing an SVG actually removes
An SVG is text, so it gets smaller by removing text the picture doesn't need. Design apps save editor metadata, comments, hidden layers, empty groups, unused gradients and long numbers like 40.000000. This page uses SVGO, the open-source optimizer most build tools use, to strip that safely: it rounds coordinates to the decimal places you choose, rewrites path data in its shortest form (relative commands, no repeated letters), merges styles, shortens colours (#ffffff becomes #fff) and collapses groups that do nothing. Two decimals is plenty for icons shown at normal sizes; logos printed large or cut on a machine may want three. Before optimizing, the page repairs code that won't open at all — a chat answer's ``` fence, a missing xmlns, HTML-only entities — because an AI-written SVG often renders in the chat but shows as a broken image once saved. Everything runs in your browser; files never leave your device.
Facts at a glance
| Question | Answer |
|---|---|
| Price | Free — no credits, no watermark |
| Sign-up | Not needed |
| Upload | None — SVGO runs in your browser |
| Input | .svg files (choose, drop or paste), or pasted SVG code / a chat answer with SVG in it |
| Limits | No fixed file count or size cap |
| Presets | Safe (3 decimals, IDs kept) · Balanced (2 decimals, multipass) · Maximum (1 decimal, title removed, responsive) |
| Options | Decimal places 0–5, keep IDs, keep <title>, merge shapes into paths, responsive (no width/height), drop xmlns for inline HTML, multipass, prettify |
| Repairs | Code fences and chat text, missing xmlns / xmlns:xlink, missing viewBox, and other HTML entities, bare &, missing </svg> |
| Shows | Size and gzipped size before/after, % saved, pixel match between original and result |
| Download | SVG, copy code, or all files as ZIP |
Which preset to use
| Your SVG is… | Preset | Why |
|---|---|---|
| An icon or illustration on a website | Balanced | 2 decimals is invisible at screen sizes; biggest safe saving |
| Styled or animated with CSS / JavaScript | Safe | IDs and classes stay exactly as written |
| A cut file for Cricut, Silhouette or a laser | Safe or Balanced | Keep 2–3 decimals so large cuts stay accurate |
| Inlined in HTML, size matters most | Maximum + “For inline HTML” | Drops xmlns and width/height; scales with CSS |
| Something you still want to edit by hand | Any + Prettify | Readable, indented code |
Our three examples below: a traced logo shrank 31% on Balanced, a lettering cut file 41% on Maximum, and a pasted chat answer went from 1,008 bytes of broken text to a 499-byte SVG.
Fixing SVG code from ChatGPT, Claude or Gemini
AI chats are good at writing small SVGs — icons, logos, simple illustrations — but the code they give you often isn't a valid file. It renders inside the chat because the chat app is forgiving; saved as .svg it can show as a broken image, refuse to open in Cricut Design Space or Figma, or come out cropped. The most common problems, all fixed automatically here:
- The reply text and the ```svg fence were copied along with the code.
- No xmlns="http://www.w3.org/2000/svg" on the <svg> tag — browsers then treat the file as plain XML, not an image.
- width and height but no viewBox, so the picture can't scale and gets cropped when resized.
- HTML entities such as or ©, which SVG doesn't know, or a bare & in a title like “Bean & Brew” — both make the whole file fail to parse.
- The answer was cut off and the closing </svg> is missing.
The list of repairs appears next to the preview, so you can see exactly what was changed. Need the icon as a cut file? Send the fixed SVG to SVG to DXF.
SVG optimizers compared
| Feature | This page | SVGOMG | SVGOptimizer.com | Vecta Nano |
|---|---|---|---|---|
| Where files are processed | In your browser — never uploaded | Not stated on the page | In your browser (stated) | Not stated |
| Batch + ZIP | Yes, no fixed cap | One file at a time | Up to 20 files, 50 MB | Up to 10 files, 5 MB |
| Visible options | 3 presets + decimals + 7 switches | About 50 switches | None on the first screen | Not before upload |
| Repairs broken / AI-written SVG code | Yes, with a list of fixes | No | No | No |
| Paste a whole chat answer | Yes | Markup only | No | No |
| Before/after preview | Yes, side by side | Toggle | No | Not stated |
| Gzipped size | Yes | Yes | No | Yes (headline figure) |
| Pixel check that it still looks the same | Yes | No | No | No |
| Sign-up | No | No | No | Early access, sign-in shown |
Competitor details are as shown on their own pages on 5 November 2026; tools change, so check before you rely on a feature.
Frequently asked questions
How do I reduce the size of an SVG file?
Drop it here and download the result. The Balanced preset removes editor metadata, comments and hidden elements, rounds numbers to 2 decimals and rewrites paths in their shortest form — typically 20–60% smaller, more for files saved from design apps.
Does compressing an SVG lower its quality?
Not visibly at normal precision. SVGs stay vector, so there's no blur; the only change is rounding coordinates. The pixel match line tells you if anything moved — raise decimal places by one if it did.
Why won't the SVG ChatGPT gave me open?
Usually it's missing xmlns, has or a bare & in it, or includes the ```svg fence and chat text. Paste the whole reply here; the page repairs it, lists every fix and gives you a valid .svg.
Is my SVG uploaded?
No. SVGO runs in your browser and the file never leaves your device.
What does “Keep IDs” do?
It stops the optimizer from renaming or removing id attributes. Turn it on when CSS, JavaScript, <use> links or animations point at those IDs.
Should I remove width and height?
For websites, yes — with the viewBox kept, the SVG scales to whatever size CSS gives it. For cut files and print, keep them, since they carry the physical size.
What's the gzipped size?
Web servers usually send SVGs gzip-compressed, so this is roughly what visitors actually download. It's shown for both the original and the result.
Can I compress many SVGs at once?
Yes. Drop them all; the same settings apply to each and All (ZIP) downloads them together with the total saving.
Will it break my animation or interactivity?
Use the Safe preset: IDs, classes and structure stay as written. Merging shapes into paths is off by default for the same reason.
Updated · By the imagetojpg.app team