Skip to content
UIFoundry
Performance โ€ข 8 min read

SVG Performance Optimization: Coordinate Precision, SVGO Pipelines, and Inline vs. External

How to optimize SVGs for modern web performance: stripping editor metadata, reducing path precision, SVGO config pipelines, and inline vs symbol delivery.

By the UIFoundry Editorial Team

Scalable Vector Graphics (SVG) are the foundation of modern web interface iconography, logos, and illustration systems. Because SVGs are XML documents composed of text vectors rather than rasterized bitmap grids, they scale infinitely across any device resolution.

However, exporting SVGs directly from vector design software (Figma, Adobe Illustrator, Sketch) into production web repositories introduces significant performance bloat. Unoptimized SVGs carry thousands of bytes of hidden metadata, excessive path coordinate decimals, and redundant DOM nesting.

The 4 Primary Culprits of SVG Bloat

  1. Design Software Metadata: Illustrator and Inkscape insert proprietary XML namespace tags (xmlns:i, sketch:type, figma:type), editor version strings, and comments that browsers ignore.
  2. Excessive Coordinate Precision: A vector path exported with 6 decimal places: d="M12.483921 45.192847 L89.102938 12.002948" Each digit is an ASCII byte. Reducing precision to 1 decimal place (d="M12.5 45.2 L89.1 12") cuts path string weight by 60% with zero visual difference on high-DPI screens.
  3. Empty Groups and Redundant Transforms: Complex Figma components export with multiple layers of empty <g id="Frame_1"> wrappers and complex translation matrices that force browser rendering engines to calculate unnecessary transformation math.
  4. Unconverted Primitives: Rectangles and circles defined as complex polygonal paths instead of clean <rect> or <circle> primitives consume 3x more bytes.

The Production SVGO Pipeline Configuration

Automate optimization using svgo in your CI/CD build or pre-commit hooks. Below is a production svgo.config.js:

module.exports = {
  multipass: true, // Re-runs optimizer passes until file stabilizes
  plugins: [
    {
      name: 'preset-default',
      params: {
        overrides: {
          removeViewBox: false, // Essential: preserve viewBox for responsive scaling
          cleanupNumericValues: {
            floatPrecision: 1, // Cap decimals at 1 place
          },
        },
      },
    },
    'removeDimensions', // Removes width/height attributes so CSS controls size
    'removeXMLNS', // Removes redundant XML namespaces
    'convertStyleToAttrs', // Converts inline CSS styles to lighter presentation attributes
    {
      name: 'removeAttrs',
      params: {
        attrs: '(data-name|data-id)', // Strip automated Figma layer tags
      },
    },
  ],
};

Delivery Architecture: Inline vs. SVG Sprite Sheet

Delivery ArchitectureHTTP CacheabilityDOM OverheadDynamic CSS Styling (fill, stroke)Best Use Case
Inline <svg> in HTMLNone (Re-downloaded with every HTML page)High (Every node added to main DOM tree)Complete (Can style child paths via CSS)Hero illustrations, complex animated vectors
External <img> TagHigh (Cached by browser HTTP cache)Zero (Isolated image render box)None (Cannot target internal paths via CSS)Marketing brand logos, static decorative art
External SVG Sprite <use>High (Cached across entire session)Minimal (Lightweight reference proxy)Moderate (Parent currentColor inheritance)UI Icon Sets (30+ icons used repeatedly across site)

Sources and references

Frequently asked questions

Why are raw SVGs exported from Figma or Illustrator unnecessarily large?
Design tools export extensive metadata: editor namespace tags, redundant nested group tags (<g>), hidden clipping masks, invisible fill paths, and float coordinate precision with 6+ decimal places.
How much file size reduction can SVGO achieve on vector assets?
A properly configured SVGO pipeline typically reduces raw vector file sizes by 50% to 80% without any perceptible degradation in visual rendering quality.
What is the performance trade-off between inlining SVGs and using an external SVG sprite?
Inlining SVGs bloats HTML document size and cannot be cached by browser HTTP caches. External SVG sprites (<use href="/icons.svg#icon-name">) are cached across pages, drastically reducing First Contentful Paint (FCP).

About the author

Written by the UIFoundry Editorial Team, which researches, writes, and tests every guide on this site. Read more about our editorial standards or contact us with suggestions.