imagetojpg.app
Tools

Compress SVG — Optimizer and SVG Code Fixer

Drop in SVG files or paste SVG code — even a whole chat answer with the code inside — and get a smaller, valid SVG back. Pick a preset, see the before and after side by side with the bytes saved and a pixel check, then download, copy or ZIP the lot.

Original
Optimized
Preset
Optimized in your browser with SVGO · never uploaded · no file limit, no sign-up

In short

Free, with no sign-up and no upload: choose, drop or paste SVGs above. The page first repairs broken code — code fences, missing xmlns or viewBox, HTML entities like &nbsp;, bare “&”, a missing </svg> — then runs SVGO with the Safe, Balanced or Maximum preset. Set decimal places 0–5, keep IDs or <title>, make it responsive or inline-ready. It shows the size and gzipped size before and after and checks the result still looks the same. Batch download as ZIP.

Three SVGs compressed and repaired with this tool

Real results from this tool. Right is the downloaded file; sizes are bytes on disk.

SVG pasted from a chat answer: original SVGBefore
SVG pasted from a chat answer: Optimized resultOptimized

SVG pasted from a chat answer

Paste · Balanced preset

In
1,008 B of text: code fence, no xmlns, no viewBox, &nbsp; and a bare “&”
Out
499 B valid SVG that opens everywhere (−50%)

5 repairs first — without them the file shows as a broken image. Then 6-decimal numbers were rounded and the comment removed.

4-colour traced logo: original SVGBefore
4-colour traced logo: Optimized resultOptimized

4-colour traced logo

Balanced · 2 decimals

In
8.2 KB · 2.2 KB gzipped
Out
5.7 KB · 1.6 KB gzipped (−31%)

Already a lean file from our tracer, still a third smaller. Pixel check: identical at 160 px.

Hand-lettering cut file: original SVGBefore
Hand-lettering cut file: Optimized resultOptimized

Hand-lettering cut file

Maximum · 1 decimal, responsive

In
11.7 KB · 5.7 KB gzipped
Out
6.9 KB · 3.2 KB gzipped (−41%)

One decimal is still 0.1 px — far finer than a vinyl blade. Width/height removed so it scales to its container.

How to compress an SVG

  1. 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.
  2. 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.
  3. Check the two previews and the pixel match line. If small details moved, raise the decimal places by one.
  4. 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

QuestionAnswer
PriceFree — no credits, no watermark
Sign-upNot needed
UploadNone — SVGO runs in your browser
Input.svg files (choose, drop or paste), or pasted SVG code / a chat answer with SVG in it
LimitsNo fixed file count or size cap
PresetsSafe (3 decimals, IDs kept) · Balanced (2 decimals, multipass) · Maximum (1 decimal, title removed, responsive)
OptionsDecimal places 0–5, keep IDs, keep <title>, merge shapes into paths, responsive (no width/height), drop xmlns for inline HTML, multipass, prettify
RepairsCode fences and chat text, missing xmlns / xmlns:xlink, missing viewBox, &nbsp; and other HTML entities, bare &, missing </svg>
ShowsSize and gzipped size before/after, % saved, pixel match between original and result
DownloadSVG, copy code, or all files as ZIP

Which preset to use

Your SVG is…PresetWhy
An icon or illustration on a websiteBalanced2 decimals is invisible at screen sizes; biggest safe saving
Styled or animated with CSS / JavaScriptSafeIDs and classes stay exactly as written
A cut file for Cricut, Silhouette or a laserSafe or BalancedKeep 2–3 decimals so large cuts stay accurate
Inlined in HTML, size matters mostMaximum + “For inline HTML”Drops xmlns and width/height; scales with CSS
Something you still want to edit by handAny + PrettifyReadable, 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 &nbsp; or &copy;, 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

FeatureThis pageSVGOMGSVGOptimizer.comVecta Nano
Where files are processedIn your browser — never uploadedNot stated on the pageIn your browser (stated)Not stated
Batch + ZIPYes, no fixed capOne file at a timeUp to 20 files, 50 MBUp to 10 files, 5 MB
Visible options3 presets + decimals + 7 switchesAbout 50 switchesNone on the first screenNot before upload
Repairs broken / AI-written SVG codeYes, with a list of fixesNoNoNo
Paste a whole chat answerYesMarkup onlyNoNo
Before/after previewYes, side by sideToggleNoNot stated
Gzipped sizeYesYesNoYes (headline figure)
Pixel check that it still looks the sameYesNoNoNo
Sign-upNoNoNoEarly 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 &nbsp; 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

More free tools

Image to JPGAny format — HEIC, AVIF, PNG, WebP, GIF, BMP — to JPG.HEIC to JPGiPhone photos to JPG that opens everywhere.HEIC to PNGLossless PNG from iPhone HEIC photos.AVIF to JPGSaved an .avif from the web? Make it a JPG.AVIF to PNGAVIF to PNG with transparency kept.HEIF to JPGSamsung Galaxy and camera .heif files to JPG.HEIC ConverterHEIC to JPG, PNG, WebP or PDF in one box — keep EXIF, drop GPS, no upload.PNG ConverterAny image to PNG, or PNG to JPG, WebP, PDF and multi-size ICO — no upload.WebP to PDFCombine WebP images into one PDF — reorder, A4/Letter, margins, no upload.PNG to PDFMerge many PNGs into one PDF with lossless, pixel-sharp pages — no upload.PNG to EPUBComics, picture books and scans to an EPUB e-book — cover, contents, no upload.Image to TextCopy the text out of any photo or screenshot — OCR on your device, 19 languages.Picture to WordExtract text from a photo or screenshot into an editable Word .docx — on your device.JPEG to JPG.jpeg, .jpe, .jfif → .jpg, lossless, in bulk. Optional EXIF removal.JFIF to JPGFix .jfif downloads — lossless, no re-compression.Compress JPGShrink JPGs to 100 KB, 200 KB or any size, with a before/after slider.Compress Image to KBMB to KB: any photo to 20, 50, 100 or 200 KB — exam forms, signatures.Resolution ChangerChange pixel size or DPI (72/150/300). Passport and Instagram presets.MP4 to JPGExtract JPG frames from MP4, MOV or WebM — video never uploaded.Image EnhancerAI sharpens detail and cleans JPEG blocks, 2× / 4× — free, no upload.Unblur ImageFix blurry photos, faces and text with AI — Light, Medium or Strong.Upscale ImageMake images bigger without blur: 2×, 4× or 4K, free, nothing uploaded.Free Image UpscalerAI upscale 2× or 4× with no credits, no sign-up, no watermark.4K Image UpscalerUpscale photos to 3840 px for 4K wallpapers, TVs and prints.Image to SVGPNG/JPG to SVG cut files for Cricut and Silhouette — colour layers, DXF, no upload.QR Code with LogoYour logo in the middle, scan-checked, PNG or SVG — static, never expires.WhatsApp Sticker MakerPhoto to 512×512 WebP sticker: background removed, white outline, text — no app.Sticker MakerPhoto to sticker: background removed, white outline, transparent PNG or A4 print sheet.Handwriting to FontFill in a template, snap a photo, download your handwriting as a TTF font.Image to Pixel ArtPhoto to pixel art: pixel size, retro palettes, dithering — PNG or SVG, no upload.GIF CompressorShrink animated GIFs by up to 90% or fit them under a target MB/KB — no upload.GIF ResizerResize animated GIFs by percent or pixels; 128 emoji and 512 sticker crops.GIF to WebPAnimated GIF to animated WebP — usually far smaller, batch, no upload.GIF to APNGAnimated GIF to animated PNG with exact pixels and loop control.GIF Speed ChangerSpeed up, slow down, reverse or boomerang a GIF — lossless timing edits.SVG to DXFSVG to DXF in mm or inches for LightBurn, Silhouette and CAD — layers by colour.Gemini Watermark RemoverRemove the Nano Banana sparkle — exact pixels restored, no upload.PFP Collage Maker“Who is in the pfp of your apps” template — one labelled picture per app, 1:1 or 9:16.Movie Scene Collage3 photos as stacked widescreen movie stills — subtitles, grain, Pinterest & Story sizes.Image Text RemoverErase captions, date stamps and words — auto-detect, batch, no upload.Remove AI LabelsStrip C2PA, IPTC AI tags and prompts — pixels unchanged, no upload.AI Image DetectorIs this image AI? Reads Content Credentials, AI tags and prompts — no upload.Magic Wand ToolClick to select a colour area, then delete it or cut it out as a PNG.PNG Text GeneratorText to transparent PNG with gradient, outline, glow and 3D styles.Wallpaper GeneratorGradients, waves or your photo at your phone's or monitor's exact size.Color Picker from ImageClick any pixel for HEX, RGB and HSL, plus a palette.Passport Photo MakerUS, UK, EU, Canada, Australia sizes — checked JPG + 4×6 print sheet.Passport Size Photo3.5 × 4.5 cm photos: 32 on an A4 sheet or 8 on 4×6, free.US Visa & Passport Photo2x2 in / 600×600 JPG under 240 kB, checked — DS-160 and DV lottery.