SVG optimizer · converter · sanitiser
Make the SVG smaller without uploading it.
Paste or open an SVG. SVGForge strips editor junk, rounds coordinates, merges empty groups and rewrites path data, then hands you the same artwork as clean SVG, a React component, a TypeScript icon, a CSS data URI or Base64. Every pass runs in this tab.
- No upload
- XSS sanitiser
- React & TSX
- CSS data URI
- Accessibility check
SVG source
Text only. The file is read by this page, never sent to a server. Preview rendering uses an image data URI, so even an unsanitised file cannot run script here.
Preview
Load or paste an SVG to see it here.
The preview is drawn from the optimised output, so what you see is what you download.
Output
—
Minified SVG. Byte counts are UTF-8 bytes of the text, close to what a gzip server sends after compression.
Method
What each pass does
Removes what editors add
Illustrator, Inkscape, Figma and Sketch write <metadata>, comments, RDF blocks and their own namespaced attributes into every export. They affect nothing on screen and can outweigh the drawing itself. Removing them is the safest large saving available.
Rounds numbers, not shapes
Coordinates are rounded to the precision you pick, trailing zeros and leading zeros are dropped, and path data is rewritten in whichever of the absolute or relative form is shorter. Two decimals is plenty for icons up to 1024 px; the visual difference is below one device pixel.
Converts without a build step
The same optimised markup becomes a React or TypeScript component with correct JSX attribute names, or a CSS data URI with the escaping browsers actually require. Copy it or download the file; no package or CLI is involved.
Questions
Questions
Is my SVG uploaded anywhere?
No. Parsing, optimisation, sanitising and conversion all run as JavaScript in this tab. The page has no upload endpoint and makes no network request for your file.
Can I trust the XSS sanitiser?
It removes <script>, <foreignObject>, event-handler attributes such as onload, javascript: links and expression() styles. That covers the common SVG injection routes, but no sanitiser is a substitute for serving untrusted SVG from a separate origin with a restrictive CSP.
How much smaller will my file get?
Editor exports commonly lose 40–70% once metadata, comments and namespace declarations are gone. Hand-written icons usually save 5–20% from precision and path rewriting. The exact before and after byte counts are shown beside the output.
Does the optimiser change how the artwork looks?
It only removes invisible data, shortens number spelling and rewrites path commands into equivalent forms. At 1 decimal place very fine detail can shift; check the preview and compare with 2 or 3 decimals before shipping.
Guides