Free SVG test files and sample generator
XML-based vector image format that scales without quality loss. Ideal for icons, logos and resolution-independent UI assets.
What is a .svg file?
SVG: Scalable Vector Graphics. SVG is vector graphics as XML, so it scales without loss, and, importantly, it can contain script. That dual nature makes it both a design asset and a security concern worth testing deliberately.
Why generate a test SVG file?
- Test an SVG sanitizer: uploaded SVG is a genuine XSS vector.
- Check vector rendering and scaling in a viewer or PDF pipeline.
- Verify XML parsing of a large document.
What you can put inside a .svg file
You get 6 content options for SVG, so the file holds something meaningful rather than random padding: Shapes, Bar chart, Pie chart, Icon, Text, QR code. Pick several and they are merged into one file, with a section, sheet, slide or folder for each.
How a .svg file is identified
A .svg file has no signature at the start. A text format has no identifying leading bytes, so the extension and the reported media type are the only claims about it until a parser actually reads it, which is why validating uploads by extension alone is unsafe.
How the size lands on the exact byte
XML permits whitespace after the root element, so the padding goes there. The document still parses, and the tree is unchanged.
Negative testing with broken SVG files
- Invalid. Identifiable, but wrong inside, so it fails during parsing.
- Corrupted. The leading bytes are destroyed. Same length as the valid file.
- Incomplete. Truncated part-way, so it is genuinely shorter.
- Empty. Chosen under Content rather than File Condition: valid structure, no data.
Which failure to reach for, and what to assert for each, is covered in how to make a corrupted file for testing. For upload limits and type checks see testing file upload validation, and for this format's encodings, UTF-16 and BOM test files.
Sample SVG content
<svg viewBox="0 0 24 24"> <circle cx="12" cy="12" r="10" fill="#1a5f7a" /> </svg>
This shows the shape of the file. Your download is generated fresh at the size you choose, so the values will differ.
How to open and verify the file
Open in any browser, or validate as XML with `xmllint --noout file.svg`.
Media type image/svg+xml · extension .svg · category Images
Generate a .svg file → · questions about sizes, privacy or cost are answered on the site FAQ.
Frequently asked questions about SVG files
What identifies a .svg file?
Nothing at the start of the file does. A text format has no identifying leading bytes, so the extension and the reported media type are the only claims about it until a parser actually reads it, which is why validating uploads by extension alone is unsafe.
How can a .svg file be an exact number of bytes?
XML permits whitespace after the root element, so the padding goes there. The document still parses, and the tree is unchanged.
What can go inside the SVG file?
There are 6 content options for .svg: Shapes, Bar chart, Pie chart, Icon, Text, QR code. Choose more than one and they are combined into a single file, a section, sheet, slide or folder per option, rather than downloaded separately.
Can I download several broken SVG files at once?
Yes, select more than one File Condition and you get one ZIP containing a .svg per condition, each named after its condition.
Can the SVG file use UTF-16 or a byte-order mark?
Yes. .svg is a text format, so it can be generated as UTF-8, UTF-8 with a byte-order mark, UTF-16 LE or UTF-16 BE. The body is shortened before re-encoding so the finished file still lands on the exact size you asked for. Note that a UTF-16 file always has an even byte count.
How do I open or verify the SVG file?
Open in any browser, or validate as XML with xmllint --noout file.svg.