Toolkist

SVG Validator & Repair

Validate, repair, optimize and preview SVG files. Catches XML errors, unsafe scripts, external refs and contrast issues.

SVG

Drop an SVG file here

or click to browse

About SVG Validator & Repair

What does validation check?

XML well-formedness, correct root element, xmlns and viewBox presence, embedded scripts, on* event attributes, external references, empty groups, missing <title>, and file size.

What does auto-repair fix?

Adds xmlns="http://www.w3.org/2000/svg" if absent, derives viewBox from width/height if both are present, and removes empty unnamed <g> elements.

What does sanitize do?

Removes all <script> elements, strips on* event attributes from every element, and removes javascript: href values. Does not alter valid SVG content.

What does SVGO optimize do?

Runs SVGO multipass over the SVG — removes comments, metadata, unused defs, optimises path data and numeric precision, merges transforms. Loaded on demand the first time you click Optimize.

What is "Copy as URI"?

Produces a base64-encoded data:image/svg+xml string. Paste it directly into CSS background-image: url(…) or an <img src> attribute without needing a separate file on a server.

What is the dark-mode contrast check?

When the dark preview background is active, validation flags elements with black or default (inherited black) fill — these would be invisible on a dark background. Switch to the dark preview bg to trigger the check.

Are files uploaded anywhere?

No. Everything — validation, repair, sanitize, minify, pretty-print, optimize, and preview — runs entirely in your browser. No files or data leave your device.

Keywords: SVG validator, SVG repair, SVGO optimize, SVG preview, SVG sanitize, xmlns missing, viewBox missing, SVG minify, SVG pretty print, data URI, in-browser SVG tool