SVG Optimizer
Smaller SVG, PNG and React JSX

Paste or drop an SVG and shrink it. Switch each clean-up on or off, compare before and after on light, dark and checkerboard backgrounds, then export the optimized SVG, a PNG, a data URI or a React component. Scripts are removed by default. 100% client-side. Zero data stored.

SVG Optimizer illustration: a bloated SVG file shrinking into a small clean one

SVG Optimizer Tool

The optimizer (about 800 KB) loads from this site the first time you optimize an SVG, then your browser keeps it.

Options

The viewBox is never removed, and IDs are never renamed, so the SVG keeps scaling and inline copies do not clash.

Common Use Cases

Design Tool Exports

Illustrator, Inkscape, Sketch and Figma save editor data, long decimals and empty groups. Strip it before the file goes on a website.

React Components

Turn an icon into a JSX or TSX component with camelCased attributes and props passed through, ready to size and color from the outside.

Faster Pages

Inline icons and logos add to every page load. Smaller SVG means less HTML to download, and gzip shrinks the sorted, rounded result further.

Cleaning Untrusted SVG

An SVG from a stranger can carry script. Strip scripts and event handlers before you host it or paste it into a page, and see exactly what was removed.

PNG at Any Size

Export app-store, slide-deck or email-signature PNGs at 1x, 2x, 4x or 8x straight from the vector, with transparency kept.

Inline in CSS and HTML

Copy a data URI for a CSS background or an image tag with no extra request. For ready-made CSS snippets use the SVG URL Encoder.

Reference

What Each Option Does

OptionWhat it changesTurn it off when
Remove scripts and event handlersDeletes script elements, on* attributes, javascript: links and animations that rewrite a linkThe SVG is yours and uses script on purpose, for example an interactive diagram
Remove comments, metadata, editor dataDrops notes, RDF blocks and Inkscape or Illustrator namespacesA license or credit in the file must stay
Round numbersCuts decimals to the precision you pick, in paths, transforms and sizesTiny icons look wrong at 3 places; raise the precision, or turn rounding off for technical drawings
Shorten paths and shapesRewrites path data in shorter form, merges paths with the same style, turns rects and lines into pathsCode or CSS elsewhere targets individual shapes by element type
Collapse groups, remove hidden elementsMerges useless groups and drops shapes nobody can seeA script animates or reveals an element you can not see yet
Remove width and heightKeeps the viewBox so the image fills its containerYou need a fixed size when the file is opened on its own
Remove title and descriptionDeletes the text screen readers announceLeave it off for any meaningful image

Why previews are images

An SVG can hold script. The previews here are image elements fed by a temporary link, where scripts and outside requests never run, so even a hostile file cannot touch this page.

JSX conversion rules

stroke-width becomes strokeWidth, class becomes className, xlink:href becomes xlinkHref, style text becomes an object, and props are spread on the root so callers can set size, color and aria attributes.

Data URI choices

URL-encoded is smaller and stays readable; Base64 is about a third larger but works in any text field. The URL-encoded form uses the same rules as the SVG URL Encoder.

What it cannot do

It does not redraw artwork, convert text to outlines or fix a file that is not valid SVG. Fonts and images an SVG loads from other sites are not fetched, and files over 5 MB are refused.

Choosing a precision

Three decimals is right for most icons and logos. Use one or two for large illustrations, and four or more for small icons drawn on a tiny grid.

Open-source optimizer

The clean-up is done by SVGO, a widely used open-source optimizer under the MIT license, running inside your browser from a file hosted on this site.

Frequently Asked Questions

Why We Built This SVG Optimizer

SVG is the right format for logos, icons and diagrams, but the file a design tool hands you is rarely the file you want to ship. It carries editor data, comments, empty groups and coordinates with a dozen decimals, and a React project wants it as a component rather than a file. Most online optimizers ask you to upload the artwork, which is awkward for unreleased designs and unsafe to trust with a file you did not make.

This optimizer keeps everything in your browser and gives you control. Every clean-up is a switch, rounding has a slider, and a side-by-side preview on light, dark and checkerboard backgrounds shows whether anything changed before you copy a byte. Because an SVG can hold script, it is only ever drawn as an image, and scripts and event handlers are removed by default, with a plain note listing what was taken out.

When the SVG is ready you can copy it, download it, turn it into a PNG at any scale, copy it as a data URI, or convert it to a React component in JSX or TypeScript. The clean-up itself is done by SVGO, the well-known open-source optimizer, so you get results developers already trust, without a build step or an upload.

The SVG Optimizer is part of RJL.io's collection of free developer tools. To wrap an SVG for CSS use the SVG URL Encoder, build a full icon set with the Favicon Generator, or convert it to other formats with the Image Converter. Every tool is 100% client-side.

Is your site ready for Google and AI search?

The free SEO Analyzer checks any page in seconds - meta tags, structured data, AI crawler access - and tells you exactly how to fix each issue on your platform.