Security

SVG Security Risks & Safe Browser-Based Sanitization Explained

Because SVG is an XML dialect supported directly by browsers, an unsanitized .svg file can contain <script> blocks, onload event handlers, javascript: links, or <foreignObject> HTML payloads.

How SVGtoWebP.online Processes Files Safely

  1. We never inject SVG source into innerHTML or execute it as a document.
  2. Every upload or pasted snippet is parsed with DOMParser(..., 'image/svg+xml'), rejecting malformed XML and stripping <!DOCTYPE>/<!ENTITY> declarations.
  3. An explicit tag and attribute allowlist removes scripts, on* handlers, and unsafe URLs while preserving valid gradients, masks, clipPaths, and filters.
  4. Rasterization runs inside an isolated <img> Blob URL drawn onto Canvas 2D, and temporary object URLs are revoked immediately afterward.

Read the full technical specification in our Processing Methodology.