SVGym β€” AI-Powered SVG Compression

Open-source SVG optimization that goes beyond SVGO β€” deterministic first, AI optional.

Go Beyond SVGO: >35% avg compression (up to 80%), 1.3x avg faster rendering (up to 2.6x)

Optimize your own SVG β†’ πŸ”’ Runs 100% in your browser β€” nothing is uploaded.

Tested on real-world SVGs

Benchmarked on public SVGs β€” icons, illustrations, emoji, glyphs, flags, sketches, charts, and diagrams.

Original size After SVGO After SVGym (deterministic) After SVGym (AI mode)
Across the 33 SVGs shown, the deterministic pipeline alone reaches 56% reduction vs the original and 34% beyond SVGO (per-file average). The optional AI mode adds only a few points, reaching 60% and 38%, so the deterministic pipeline captures ~91% of the AI's savings. The AI pulls ahead mainly on complex illustrations and diagrams (16 of 33 files). Every result stays ≥ 0.99 SSIM.

Your animations and interactions are safe

SVGO can silently remove hover states, animations, and dynamic attributes. SVGym understands and preserves them.

Hover States
SVGO 402 B (βˆ’44%)
Removed :hover and :active CSS. Hover the button β€” nothing happens.
SVGym 699 B (βˆ’3%)
All interactive states preserved. Try hovering.
Animations
SVGO 791 B (βˆ’14%)
Stripped fill and stroke attrs. Pulsing circle and border gone.
SVGym 845 B (βˆ’8%)
All animation elements and styling preserved.
href Animations
SVGO 1.1 KB (βˆ’16%)
Removed href from animate elements. Dot and spinner stopped.
SVGym 1.3 KB (βˆ’0%)
href animations, markers, and media queries all preserved.

How it works

Deterministic first. SVGym profiles each file, applies the transforms that fit it, and verifies every step — the AI only steps in when real savings are left on the table.

1

Analyze

Profiles the SVG — path commands, real coordinate precision, mergeable paths — and estimates the payoff of each technique. No model call.

2

Route & optimize

A deterministic workflow applies the transforms that fit this file: quantize coordinates, merge paths, drop dead metadata, simplify curves, and more.

3

Verify

Each step is rendered before/after and checked on SSIM and size. If quality drops or it doesn't help, the change is reverted — output stays ≥ 0.99 SSIM.

4

AI fallback (optional)

Only when the deterministic result leaves savings on the table does SVGym call an LLM (your own API key) to find more — passing the same quality gate.

Install: pip install svgym · run svgym optimize icon.svg for one file, or svgym pack ./icons/ for a whole folder — cross-file analysis, a combined <symbol> sprite sheet, and a compression report. Deterministic by default; add --ai to enable the fallback.