SVG Editor

Edit, sanitize, preview and download SVG markup.

Edit SVG markup in a code editor and see a sanitised preview beside it. The tool removes unsafe content, lets you load an .svg file, and gives you buttons to copy or download the cleaned result. It suits developers who want to tidy or safely inspect SVG before using it in a site or app.

What is SVG and why sanitise it?

SVG is an XML-based vector image format. Because it is markup, an SVG file can contain more than shapes: script elements, event handler attributes such as onclick, links to external resources and embedded HTML through foreignObject. If an untrusted SVG is inserted directly into a page, that code can run and cause cross-site scripting. Sanitising means parsing the markup and removing everything that is not a safe drawing element or attribute. This tool applies the DOMPurify SVG profile, additionally forbids script, foreignObject, use, image, a and style elements and the href, xlink:href and style attributes, and shows the result through an image element so it cannot touch the page.

How to use SVG Editor

  1. Add your SVG Paste markup into SVG source or use the file button to load an .svg file.
  2. Check the preview The Sanitised preview shows the image on a checkerboard background.
  3. Read any warning If a notice says some unsafe or unsupported content was removed, compare the output with your source.
  4. Export Click Copy sanitised SVG or Download SVG to save image.svg.

Frequently asked questions

Is my SVG executed?

No. The preview is sanitised and displayed through an image element created from a data URL, and images cannot run scripts or load external resources. Unsafe content is removed before the preview is built.

Why did my CSS styles disappear?

Style elements and style attributes are forbidden by this tool. Convert them into presentation attributes such as fill, stroke and stroke-width on the elements.

Why was a use or image element removed?

use and image elements are forbidden because they reference other resources, and href and xlink:href attributes are stripped. Inline the referenced shapes directly.

Does it optimise or minify SVG?

No. It sanitises and previews. The output is the sanitised markup, so formatting may change slightly, but paths and coordinates are not optimised.

Can I load files?

Yes. Use the file button to load an .svg file into the editor, then copy or download the cleaned version.