SVG Viewer and Editor
Paste SVG code or open an .svg file and the picture appears next to its code. Edit the code and the preview redraws as you type. Switch the background to check transparent areas, zoom in, list every path command, strip editor clutter, then download the result as SVG, PNG or a React component.
| Format | Use it for |
|---|---|
| SVG (cleaned) | Websites, icons, logos; smallest file |
| PNG at 1x to 4x | Places that do not accept SVG, such as some email clients and social posts |
| React component (JSX) | Using the graphic inline in a React or Next.js project |
Updated
A code view and a live preview side by side. Nothing is uploaded: the file is read and drawn by your own browser, and the preview is shown as an image so any script inside the SVG cannot run.
Reading SVG code
An SVG file is text that describes shapes. The svg element sets up a coordinate system with its viewBox: viewBox="0 0 24 24" means the drawing uses a 24 by 24 unit grid, whatever size it is shown at. Inside, elements like rect, circle and path draw on that grid with fills and strokes.
Most icons are made almost entirely of path elements. A path's d attribute is a list of drawing commands: M moves the pen, L draws a straight line, C draws a cubic curve, A draws an arc and Z closes the shape. Upper case letters use absolute coordinates; lower case are relative to the last point. The inspector on this page spells each one out.
Why exported SVGs are bigger than they need to be
Design tools save information that helps them reopen the file: layer names, editor settings, guide positions and coordinates with six or more decimal places. Browsers ignore all of it. Removing it and rounding numbers often cuts the file size noticeably, which matters when the same icon appears on every page.
This page does a conservative clean-up that should never change how the picture looks. For deeper changes, such as merging paths, the SVG optimizer tool goes further.
How it works
- Paste SVG markup into the code box, drop a file onto it or use Open file. A sample is loaded so you can try the tools straight away.
- Edit the code. The preview updates as you type and tells you when the markup is broken.
- Change the preview background to white, dark or a checkerboard, and zoom from 25% to 800% to check fine detail.
- Open the path inspector to see each path's commands in plain words, such as Move to, Line to and Cubic curve, with their numbers.
- Click Clean up to remove comments, metadata and editor attributes and to round long decimals, then download it as SVG or PNG, or copy it as JSX.
Tips
- Keep the viewBox attribute and remove fixed width and height if you want the SVG to scale with its container in CSS.
- Set fill or stroke to currentColor in icons so they take the text colour of whatever they sit in.
- Two decimal places are enough for almost any icon drawn on a 24 or 100 unit grid. More precision mostly adds bytes.
- Never paste an SVG from an untrusted source straight into your page's HTML. Inline SVG can carry scripts; load it with an img tag or clean it first.
Frequently asked questions
How do I open an SVG file?
Any modern browser opens SVG files directly, but it only shows the picture. To see the code and the picture together, open the file in this viewer with the Open file button or drag it onto the code box.
Is my SVG uploaded anywhere?
No. The file is read by your browser and drawn locally. Nothing you open or type here is sent to a server.
Why does my SVG show nothing in the preview?
The most common causes are a missing xmlns="http://www.w3.org/2000/svg" attribute on the svg element, a viewBox that points away from the drawing, or white shapes on a white background. Try the checkerboard background and check the error line under the preview.
What does the clean-up step remove?
Comments, the XML declaration, doctype, metadata blocks, editor-specific attributes from tools like Inkscape, Sketch and Serif, and empty groups. It also rounds decimals to the precision you choose. It does not merge paths or change shapes, so the drawing should look the same.
How do I use an SVG in React?
Copy the JSX output. It converts attributes to React names, such as stroke-width to strokeWidth and class to className, turns style strings into objects and passes any props you give the component through to the svg element.
Related: SVG optimizer, SVG to PNG converter, PNG to SVG converter, Free SVG icon libraries compared, All free tools.
Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.
More in Free Tools
- SVG Wave and Shape Divider Generator
- Table of Contents Generator
- Tailwind Color Palette Generator
- Terms and Conditions Generator
- Text Diff Checker
- Text Gradient Generator
- Word to HTML Converter
- Time Card Calculator
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App