local/tools
media / Single executable / v1.0.4

SVG Optimizer

Optimize and minify SVG files with SVGO and export them to PNG.

Install

  • install
    irm https://raw.githubusercontent.com/chayprabs/localtools/main/svg-optimizer/install.ps1 | iex
  • update
    localtools-svg-optimizer update
  • remove
    localtools-svg-optimizer uninstall

Opens at http://127.0.0.1:47127 in your browser. Run localtools-svg-optimizer --help for the command line. Set LOCALTOOLS_NO_OPEN=1 to install without opening it.

Direct download

PlatformFileSize
Windows x64svg-optimizer-1.0.4-windows-x64.zip45.0 MB
macOS Apple Siliconsvg-optimizer-1.0.4-macos-arm64.zip32.0 MB
macOS Intelsvg-optimizer-1.0.4-macos-x64.zip33.7 MB
Linux x64svg-optimizer-1.0.4-linux-x64.zip42.3 MB
Linux ARM64svg-optimizer-1.0.4-linux-arm64.zip42.6 MB

SHA-256 checksums are in the release notes; the install scripts verify them for you.

See it

How to use

  1. Run localtools-svg-optimizer; the page opens at http://127.0.0.1:47127.
  2. Drop one or more .svg files (or paste SVG markup).
  3. Pick Safe or Aggressive, plus any toggles: keep viewBox, remove width/height, prefix IDs, multipass, sanitize, PNG width.
  4. Press Optimize to see before/after sizes and side-by-side previews; download one file, its PNG, or all as a zip.
  5. From a terminal: localtools-svg-optimizer optimize icons/ -o out/ --sanitize --png 512

FAQ

Will the optimized SVG look different, or break my sprite sheet?

Not with the Safe preset: it runs SVGO's preset-default but keeps every id, <symbol> and <defs> entry, so file.svg#icon links and outside CSS keep working, and tests render every sample before and after with resvg (at most 0.5% of pixels may differ). Aggressive also drops unreferenced ids, symbols and defs, <title>/<desc>, and rounds to 2 decimals.

Is it safe to accept SVG uploads after sanitizing?

Sanitize keeps only drawing elements and removes scripts, event handlers, foreignObject, external links, and any CSS that loads something from outside (url(), @import, @font-face, image-set and similar), after decoding CSS escapes the way a browser does. It is tested against 30 SVG XSS payloads and 59 CSS, namespace and SMIL payloads by inlining the result into a live browser page. Still serve user SVGs with a Content-Security-Policy as defence in depth.

Why did removing the viewBox not happen?

SVGO only removes viewBox when width/height make it redundant (same origin and size). With mm units or a different size it keeps it, because removing it would change scaling. Turning on Remove width/height always keeps the viewBox.

Does anything get uploaded?

No. Everything runs in the local program on 127.0.0.1; it makes no network requests.

Why does text in the PNG use a different font?

PNG export uses resvg with your system's common fonts (Arial, Helvetica, DejaVu, Liberation). Fonts not found there fall back to a default. The optimized SVG itself keeps your font settings.