SVG Previewer & Optimizer
SVG Previewer & Optimizer shows SVG markup on a checkerboard stage, strips comments and editor metadata, and copies clean code without XSS risk.
About this tool
DOMParser parses input as image/svg+xml, removes script/foreignObject elements and inline event attributes, optionally strips comments and metadata, collapses whitespace, and previews the result safely as a data:image/svg+xml URI inside an <img> tag. Clean inline SVG icons before pasting into HTML or React.
How to use the SVG previewer
- Paste SVG markup into the box, or start with the sample.
- Check the checkerboard preview. Transparent areas show the pattern behind them.
- Tick Strip comments and metadata to shrink the file and remove editor notes.
- Copy the optimised SVG, or press Download .svg to save it.
What SVG is
SVG, scalable vector graphics, is a text format that describes shapes with coordinates, colours and paths. Because it is text, it can be read, edited and styled in code, and it stays sharp at any size. Icons, logos and diagrams are often delivered as SVG for these reasons.
Design tools add comments and metadata that help the designer but are not needed by a browser. Removing them keeps the file small and avoids leaking tool details.
A worked example
The sample is a small icon: a blue rounded tile with a white search glass drawn as a circle and a handle. The preview shows it on the checkerboard, and the optimised output drops the comment and the metadata line, which makes the file shorter without changing how it looks.
- Check that an icon exported from a design tool renders the same in a browser.
- Strip the metadata from a logo before publishing it on a website.
Who uses an SVG previewer
- Web developers checking icons before adding them to a page.
- Designers handing over logos and icons.
- Teams reducing page weight by trimming SVG files.
- Students learning how vector graphics are written.
- Anyone who has an SVG that will not show correctly.
Tips and common mistakes
- Check the viewBox. A wrong viewBox makes the picture too small, too large or cropped.
- Paste only the SVG element, not a web page around it, or the preview will not show it.
- External links and scripts inside an SVG can be a security risk. Do not paste SVG from sources you do not trust.
- Optimisation here removes comments and metadata only. Other tools can reduce path data further.
- The preview is drawn in your browser, and the SVG is not sent to our server.
Frequently asked questions
Aspect Ratio Calculator
Aspect Ratio Calculator simplifies ratios using the GCD, scales pixel dimensions proportionally and copies CSS aspect-ratio rules, in your browser.
Box Shadow Generator
Box Shadow Generator designs CSS shadows visually with X/Y offset, blur, spread, opacity and inset controls, locally in your browser.
Color Converter
Color Converter translates colors between HEX, RGB, HSL and CSS OKLCH with a live swatch preview and RGB sliders, locally in your browser.
No matching tools. Clear the filter to see all.