why is my svg file so large

Why Is My SVG File So Large? (Causes and Fixes)

By Sven Borden · · Updated

TL;DR. A bloated SVG usually has one of four causes: an embedded PNG or JPEG stored as base64 text, thousands of paths from tracing a photo or noisy image, editor data such as Illustrator's embedded AI file, or long decimal coordinates and whitespace. Open the file in a text editor to see which, then fix that cause rather than only compressing.

Convert your file now →

You exported a logo as SVG, expecting a few kilobytes, and got a 3 MB file that makes your page or your cutting software crawl. An SVG is plain text describing shapes, so its size comes from whatever text is inside it. Open it in a text editor and you can usually tell the cause within a minute.

How do I find out what is making my SVG large?

Open the .svg file in any plain-text editor (VS Code, Notepad, TextEdit in plain-text mode) and look for these signs:

What you see in the fileCauseTypical fix
<image followed by data:image/png;base64, and a wall of random lettersA raster image embedded in the SVGTrace the image into real vector shapes
Thousands of <path lines, each with long d="…" stringsToo many shapes from tracing a photo or a noisy imageSimplify the source and re-trace
i:pgf, sodipodi:, inkscape: or <metadata> blocksEditor data saved alongside the drawingRe-export as plain or optimised SVG
Numbers like 142.83746291 everywhere, lots of indentationExcess precision and whitespaceRun it through an optimiser

Most bloated files have one dominant cause. Fix that first, then optimise.

Is there a PNG hiding inside my SVG?

This is the most common cause of a multi-megabyte "SVG". The SVG <image> element can place a bitmap inside the drawing: MDN's reference for <image> lists JPEG and PNG as the formats every SVG viewer must support. Many tools and online "converters" use it to wrap a PNG in an SVG container without tracing anything.

When the bitmap is embedded rather than linked, it is stored as Base64 text. MDN notes that the Base64 version of a file is roughly a third larger than the original. So a 2 MB PNG becomes a file of about 2.7 MB with an .svg extension. It still pixelates when you scale it up, and a cutting machine has no outlines to follow.

Fix: convert the image into actual vector paths with a tracer. You can try it on swiss-vector-svg.com with a free watermarked preview before spending a credit on the clean SVG. If you need the photo itself, keep it as a PNG, JPEG or WebP next to the SVG instead of inside it.

Did tracing produce too many paths?

Tracing turns every region of colour into a shape. A flat logo becomes a few dozen paths. A photo, a scanned image with paper texture, or a low-quality JPEG full of compression artefacts becomes thousands of paths, each with many nodes. The file grows with the number of nodes, and every node is stored as a coordinate pair.

Fix it at the source:

  1. Crop to the subject and remove the background.
  2. Reduce the image to the few colours you actually need.
  3. Re-trace with stronger speckle filtering, so specks smaller than a few pixels are dropped instead of becoming shapes.
  4. Simplify what remains in Inkscape (Path › Simplify) or Illustrator.

If the source is a real photograph, vectors are the wrong format for it; how to vectorize a photo explains which photos trace well and how to prepare the ones that don't. For hand edits after tracing, follow the order in how to clean up a traced SVG.

Is your editor saving extra data?

Vector editors store information for their own use alongside the drawing:

  • Illustrator. The Preserve Illustrator Editing Capabilities option in the SVG save dialog embeds a full AI file inside the SVG so Illustrator can reopen it with layers and effects intact. Adobe's own manual describes this as "resulting in a larger file size". Untick it for any SVG you're going to publish or send, and keep a separate .ai master file instead.
  • Inkscape. The default Inkscape SVG format adds inkscape: and sodipodi: attributes, guides and editor settings. Choose Plain SVG or Optimized SVG in the Save As dialog for files you're going to share.
  • Figma and others. Exports can include hidden layers, masks and oversized frames. Delete what isn't visible before exporting.

Are the coordinates too precise?

Editors often write coordinates with six to eight decimal places and indent every line. Neither changes what you see: a screen or a blade can't resolve a millionth of a pixel. SVGO, the standard open-source optimiser, notes that SVGs exported from vector editors "usually contain a lot of redundant information". It strips comments and metadata, rounds numbers, merges paths where it can and removes whitespace. Its web front-end, SVGOMG, lets you toggle each option and compare the result before saving.

Run an optimiser last, after fixing the main cause. Optimising a file with a base64 PNG inside saves almost nothing, because the image data is already compressed.

When is a large SVG fine?

A detailed illustration with hundreds of shapes, gradients and text can legitimately weigh a few hundred kilobytes. If it's going on a website, the server's gzip or Brotli compression shrinks SVG text much further in transit, and PNG vs SVG for the web and SVG vs WebP for websites cover when each format is the lighter choice. The problem is a simple graphic that weighs megabytes: that almost always means one of the causes above.

Frequently asked questions

How big should an SVG file be?
A logo or icon made of flat shapes is usually somewhere between 1 KB and 50 KB. A detailed multi-colour illustration can reasonably reach a few hundred kilobytes. If a simple graphic is over 1 MB, something other than the shapes is inside the file, most often an embedded raster image or editor data.
Is an SVG bigger than a PNG of the same image?
For flat artwork, no: the SVG is normally smaller because it stores a few shapes instead of every pixel. For photographs it flips. Tracing a photo produces thousands of paths, so the SVG ends up larger than the PNG or JPEG it came from and looks worse.
Does gzip make large SVGs fine on a website?
Gzip or Brotli compression shrinks SVG text a lot on the wire, often by more than half, because path data repeats. It does not fix the cause. An embedded base64 image is already compressed data and barely shrinks, and a browser still has to parse and draw every path after download.
Can I reduce SVG file size without changing how it looks?
Yes. Removing editor metadata, comments and whitespace, and rounding coordinates to one or two decimal places, makes no visible difference at normal sizes. SVGO does this automatically. Simplifying paths or reducing colours does change the shapes slightly, so check the result at the size you'll use it.

Ready to convert?

Drop your file, preview the trace free, and download a clean SVG.

Open the converter →