consolelog.tools

SVG Optimizer

Shrink SVG files with SVGO — strip editor cruft, metadata and redundant precision while keeping the artwork pixel-identical. Tune every pass, preview before vs. after live, and copy a ready-to-paste SVG, data URI, CSS, <img>, JSX or Markdown snippet. 100% in your browser.

About this ToolHow it works, benefits & use cases

Optimize SVG files online with SVGO, the same optimizer that runs in production build pipelines — here it runs entirely in your browser. Whether you call it optimizing, minifying, or compressing an SVG, the job is the same: strip what does not render and shorten what does, losslessly. Paste markup or drop a .svg file (up to 5MB) and it optimizes live, stripping editor cruft, metadata, and redundant numeric precision while keeping the artwork pixel-identical. Start from a preset (Balanced, Maximum compression, CSS icon, or Readable), then fine-tune every pass: float precision, multiple passes, pretty-print with a chosen indent, keep or drop the viewBox, remove width/height for CSS-scaled icons, minify IDs, strip title and desc, and sort attributes for a better gzip ratio. A side-by-side before/after preview confirms the result renders the same, and a stats panel shows original vs. optimized size with the percentage saved. Export the optimized SVG, or copy it as a data URI (raw or base64), CSS background, an <img> tag, React JSX, or Markdown. SVGO is lazy-loaded and runs entirely client-side.

How to Use

  1. 1Paste your SVG markup, or drop/upload a .svg file (max 5MB); click “Load example” to try it instantly.
  2. 2Pick a preset — Balanced, Maximum compression, CSS icon, or Readable — under Optimization.
  3. 3Fine-tune the options: float precision, multiple passes, pretty-print, keep viewBox, remove width/height, minify IDs, strip title & desc, sort attributes.
  4. 4Check the side-by-side preview and the stats panel showing original vs. optimized size and percentage saved.
  5. 5Choose an output format (SVG, data URI, CSS, HTML, React JSX, or Markdown) and copy or download the result.

Key Benefits

  • Real SVGO optimization, the same tool used in production build pipelines
  • Live, debounced optimization with a before/after preview on a transparency checkerboard
  • Four presets plus granular control over precision, passes, IDs, viewBox and dimensions
  • Keeps the artwork pixel-identical — only the bytes change
  • Stats panel with original size, optimized size, and exact percentage saved
  • Export as SVG, data URI (raw or base64), CSS background, <img>, React JSX, or Markdown
  • SVGO is lazy-loaded and runs entirely in your browser — files are never uploaded

Common Use Cases

  • Cleaning up SVGs exported from Figma, Illustrator, or Sketch before committing them
  • Removing width/height so an icon scales to its CSS container
  • Generating a React JSX component from an optimized icon to drop into a codebase
  • Producing a compact data URI to inline an icon in CSS or HTML without a request
  • Comparing presets to find the smallest size that still renders identically

SVG source

Click to upload or drag and drop

Accepted: .svg,image/svg+xml • Max 5 MB

SVG only (max 5MB) — or paste the markup below

Optimization

Preset

Safe web defaults — keeps viewBox, minifies, multipass.

Decimals kept in coordinates

Re-run until stable

Readable, not minified

Needed for responsive SVGs

Scale to container (CSS icons)

Shorten id/href values

Strips accessibility text

Improves gzip ratio

Preview

Original

Optimized

The optimized SVG renders identically — only the bytes change.

Copy, download, or pipe to another tool.

Output will appear here.

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools