Free XML sample files

Structured, self-describing documents built from nested elements and attributes. Download valid XML test files in 10 exact sizes, from 1 KB to 10 MB, each with a checksum.

Extension
.xml
MIME type
application/xml
Kind
Text
Category
Data

XML files by size

Every file below is a valid Extensible Markup Language file of exactly the stated size. Open a file's page for its checksum and contents, and to preview it in your browser before downloading.

XML sample files by size
FileSizeContentsDownload
1 KB XML samplesample-xml-1kb.xml 1 KB1,024 bytes Elements: 2 <customer> records Download XML
5 KB XML samplesample-xml-5kb.xml 5 KB5,120 bytes Elements: 15 <customer> records Download XML
10 KB XML samplesample-xml-10kb.xml 10 KB10,240 bytes Elements: 31 <customer> records Download XML
25 KB XML samplesample-xml-25kb.xml 25 KB25,600 bytes Elements: 80 <customer> records Download XML
50 KB XML samplesample-xml-50kb.xml 50 KB51,200 bytes Elements: 160 <customer> records Download XML
100 KB XML samplesample-xml-100kb.xml 100 KB102,400 bytes Elements: 320 <customer> records Download XML
500 KB XML samplesample-xml-500kb.xml 500 KB512,000 bytes Elements: 1,599 <customer> records Download XML
1 MB XML samplesample-xml-1mb.xml 1 MB1,048,576 bytes Elements: 3,267 <customer> records Download XML
5 MB XML samplesample-xml-5mb.xml 5 MB5,242,880 bytes Elements: 16,276 <customer> records Download XML
10 MB XML samplesample-xml-10mb.xml 10 MB10,485,760 bytes Elements: 32,484 <customer> records Download XML

More XML samples

Hand-designed files with realistic content or a specific edge case.

Curated XML sample files
FileSizeContentsDownload
Sample product catalogue XML with namespaces and CDATAsample-product-catalog.xml 1.07 KB1,100 bytes Features: Attributes, entities, CDATA, comment, processing instruction, empty element Download XML
Sample RSS 2.0 feedsample-rss-feed.xml 2.39 KB2,451 bytes Items: 5 Download XML

What is an XML file?

XML marks up data with named elements that nest to form a tree, with attributes on elements and text inside them. It underlies many established formats, including RSS, SVG, SOAP, Office documents and countless enterprise integrations.

A document must be well-formed, meaning every element is closed and properly nested, or a parser will reject it outright. It can additionally be validated against a schema.

How to recognise an XML file

The first bytes of every file. The XML declaration is optional but usual.
Extension.xml
MIME typeapplication/xml
Also seen astext/xml
StandardW3C XML 1.0
EncodingDeclared in the document; UTF-8 by default
ValidationDTD, XML Schema or RELAX NG
FeaturesNamespaces, entities, CDATA sections, processing instructions

What to test for

These are the behaviours that most often go wrong when software handles XML files.

Strengths of XML

  • Mature tooling for validation, transformation and querying.
  • Handles documents with mixed text and markup, which JSON cannot.

Limitations of XML

  • Verbose: the same data is considerably larger than in JSON.
  • Features such as entities make parsers a security concern when misconfigured.

Typical uses of XML test files

  • Testing XML parsers and data import
  • Checking protection against entity attacks
  • Testing feed readers and SOAP clients

Software that opens XML

  • Every programming language
  • Browsers, xmllint and XSLT processors
  • Enterprise integration and publishing systems

Specifications

Related

XML sample files: questions

Do the XML samples use a DTD or entities?
No. They have an XML declaration and no DOCTYPE, so they are safe for parsers with DTD processing disabled.
What is the MIME type of an XML file?
The MIME type is application/xml. You will also meet text/xml in practice. The file extension is .xml.
Is a sample XML file the same as a dummy or example XML file?
Yes. Sample, test, dummy and example XML files are different names for the same thing: an XML file with known contents that stands in for a real one. Any file on this page will do wherever a tutorial or a test plan asks for a dummy XML file.