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.

Runs in your browser
Valid SVG
0 B
Original
0 B
Optimized
0%
Saved
—
viewBox
SVG preview

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

  1. Paste SVG markup into the box, or start with the sample.
  2. Check the checkerboard preview. Transparent areas show the pattern behind them.
  3. Tick Strip comments and metadata to shrink the file and remove editor notes.
  4. 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

Yes. Scripts and event attributes are stripped and the preview renders inside an isolated <img> element rather than inline DOM.

Search tools

Cookie & tracking info

Qgenx Tools keeps tracking minimal. Everything you type or upload runs locally in your browser.

Read the full details on our Cookie policy page.