About the Random XML Generator
XML is still common in feeds, configuration files, SOAP services and data exchange, and testing code that reads it needs sample files. This generator writes them for you. Choose how many records you want, name the root element and the record element, tick the fields to include, and decide whether to start with the XML declaration. Each record is one consistent made-up person, with a name, email and place that agree. Special characters such as ampersands in company names are escaped properly, so the result is well formed and any XML parser can read it. Emails end in example.com and phone numbers use the fictional 555-01xx range. Everything is made in your browser and nothing is uploaded.
Updated October 2026
How to use the Random XML Generator
- 1Enter how many records you want, from 1 to 500.
- 2Type the root element name and the record element name, or keep records and record.
- 3Tick the fields to include. Each becomes a child element.
- 4Leave the XML declaration ticked if the file should start with the version and encoding line.
- 5Press Generate, then copy the XML or download random.xml.
What the XML looks like
The root element holds one record element per person, and each field is a child element of its record. The default fields produce records like this, one after another:
- <record> as the container for one person
- <fullName>Mia Ortiz</fullName>
- <email>[email protected]</email>
- <city>Austin</city> and <birthDate>1987-03-14</birthDate>
When random XML is useful
- Testing an XML parser, an XSLT stylesheet or an XPath query on many records.
- Trying a feed reader or an importer that expects a repeating element.
- Writing documentation or a tutorial that needs sample XML.
- Checking how code copes with escaped characters and long files.
- Making input for a converter, such as XML to JSON or XML to CSV.
Choosing element names
Pick names that match the structure you are testing. A product feed might use catalog and item, an address book might use contacts and contact. The field names themselves, such as fullName and postalCode, are fixed so the data is easy to map.
XML names are case sensitive, so Record and record are different elements. The tool keeps the case you type.
Safe sample data
Generated data carries no personal information. The example.com domain is reserved for examples, so test emails never reach a real inbox.
Phone and computer
The options stack in one column on a phone, and the result scrolls inside its box. Copy and Download sit under the result. Sample XML is best checked before you use it. Tidy it with the XML Formatter, change it to data with the XML to JSON Converter, and make other test data with the Fake Data Generator.
Features
- Your own root and record element names, checked to be valid XML names
- Sixteen fields, each written as a child element
- Optional XML declaration with UTF-8 encoding
- Special characters escaped, so the XML is always well formed
- Up to 500 records per press, indented with two spaces
- Made on your device with the browser's secure random generator
Frequently asked questions
Is the XML well formed?
Yes. There is one root element, every element is closed, and characters such as ampersands, angle brackets and quotes are replaced by their entities, for example & for an ampersand.
Which element names are allowed?
A name must start with a letter or an underscore, may then contain letters, digits, dashes, dots and underscores, and must not start with the letters xml in any case. The tool tells you if a name does not qualify.
Does it include attributes?
No. Every value is written as a child element, which is the simplest shape to read and convert. If you need attributes, our XML tools can help you reshape the result.
Is the data real?
No. Names are picked from lists of common names, emails end in example.com, phone numbers use the fictional 555-0100 to 555-0199 range and addresses are made up.
Can I turn the XML into JSON or CSV?
Yes. Paste it into our XML to JSON or XML to CSV converters.
What does the XML declaration do?
It is the first line, <?xml version="1.0" encoding="UTF-8"?>. It tells parsers the version and the text encoding. Some programs require it and some do not, so you can switch it off.
How many records can I make?
Up to 500 per press.
Is anything uploaded?
No. The XML is generated in your browser.