SVG Viewer Online
Paste SVG markup or open a .svg file and see it drawn as an image, with zoom, three backgrounds, and a strip that shows it at icon sizes. Prettify also shows the viewBox, the file size, and the number of ids, and it warns you when the SVG will not scale. Nothing is uploaded.
What the SVG viewer does
An SVG is text that describes a drawing. A code editor shows you the text, and a browser tab shows you the drawing at one size on a white page. The SVG viewer shows the drawing and the facts you need before you use it: how it scales, how it looks on a dark background, and whether it is still clear at 16 px.
The box on this page checks the markup and shows the viewBox, the size, and the number of ids, the same facts as the badge in the editor. If the SVG cannot be drawn, the box names the line of the error. Select "Open in Image view" to see the drawing.
Key features
The Image view is the first view for SVG. The Raw view shows the source as plain text, and Both shows the source and the image side by side.
- Zoom from 10% to 3200%, or select Fit. Hold Ctrl (Cmd on a Mac) and turn the mouse wheel to zoom around the pointer.
- Drag to pan when the image is larger than the canvas.
- Choose a checkerboard, white, or dark background. Use the dark background to check a light icon.
- The size strip shows the SVG at 16, 24, and 32 px, each on a light tile and on a dark tile.
- The badge shows the viewBox, the size of the SVG text, and the number of elements that have an id.
- A notice tells you when the SVG has no viewBox, uses currentColor, or refers to an external image.
- Open as XML puts the markup in an XML tab, for the Tree view and for XPath queries.
The Image view is safe
The Image view draws the SVG as an image. A browser does not run scripts in an image, and it does not load files from outside the SVG. So scripts and onload attributes do nothing, and the SVG makes no network requests. That makes it safe to look at an icon from an unknown source.
How to view an SVG
Prettify detects SVG when the first element of the text is svg. An XML declaration, comments, and a DOCTYPE can come before it. A file with the .svg extension is always SVG.
- Paste your SVG into the box labeled "Paste your SVG", or select "Try an example".
- Read the line above the result: it shows the viewBox, the size, and the number of ids.
- Select "Open in Image view" to see the drawing.
- Press + or - to zoom, 0 to fit, or 1 to see the image at 100%.
- Select a background, then select Sizes to show or hide the size strip.
- Select Download to save the file as .svg. Copy and Download write the exact source.
Worked example: an icon that does not scale
The icon below has a width and a height but no viewBox. At 24 px it looks correct. At 16 px the browser does not shrink the drawing; it shows only part of it, so the icon looks cut off.
When you paste it, the box shows "SVG image, no viewBox" and the warning "This SVG has no viewBox, so it does not scale. Small sizes show a crop." The size strip in the editor shows the crop on the 16 px tile. Add viewBox="0 0 24 24" to the svg element, and the warning goes away and every size draws the full icon.
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
<circle cx="12" cy="12" r="10" fill="none" stroke="#2563eb" stroke-width="2"/>
<path d="M8 12l3 3 5-6" fill="none" stroke="#2563eb" stroke-width="2"/>
</svg>Common uses
Most SVG files are icons and logos that end up in a web page or an app. The viewer answers the questions that come up before you ship one.
- Check an icon from a design tool at the sizes your app uses.
- See whether a logo still reads on a dark background.
- Find out why an icon crops or does not scale.
- Look at an SVG from an unknown source without running anything it contains.
- Read the markup as XML in the Tree view before you edit it by hand.
What is free, what is Pro, and where your SVG goes
The Image view, the Raw view, the toolbar, the size strip, and Download are free. Two features are Pro: SVG Side by Side, and SVG Tools, which optimizes the SVG, makes its ids unique, and writes a React component. Pro costs US$19.99 once, with lifetime access and no subscription.
Your SVG stays on your device. Prettify does not upload it unless you create a share link.
Frequently asked questions
Is the SVG viewer free?
Yes. The Image view with zoom, backgrounds, and the size strip, plus the Raw view and Download, are free and need no account. SVG Side by Side and SVG Tools are Pro.
Why does my icon look cut off at small sizes?
It has no viewBox, so the drawing cannot scale. The browser shows a crop of it in a smaller box. Add a viewBox to the root svg element, for example viewBox="0 0 24 24" for a 24 px icon.
Why is my icon white on the dark background?
The SVG uses currentColor, which takes the text color around it. On a dark background, Prettify draws it with a white text color and shows a notice. Your document does not change.
What happens if my SVG is not valid?
The box on this page shows the error and its line. In the editor, the Image view shows "This SVG cannot be drawn." with the reason. Select Switch to Raw to fix the source.
Can I see the SVG as an XML tree?
Yes. Select Open as XML in the toolbar menu or in the command palette. Prettify puts the markup in a new XML tab, with the Tree view and XPath queries. The SVG tab stays as it is.