File Format Wiki

SVG format rules

XML-based vector image format used for icons and diagrams.

Format rules

  • Valid XML required
  • viewBox controls scaling
  • Scripts can be unsafe

Valid example

<svg viewBox="0 0 10 10"><circle cx="5" cy="5" r="4"/></svg>

Invalid example

<svg><circle></svg>

Common errors

  • Assuming SVG accepts syntax from a similar format
  • Using the wrong encoding or line ending
  • Copying invisible characters from rich text
  • Testing only the happy path and not parser errors

Online validation and conversion

Compared with nearby formats

SVG should be chosen for the parser and ecosystem that will consume it. Prefer strict formats for APIs, human-friendly formats for ops config, and signed formats only when verification is required.