2 MB XML sample file
An XML file of exactly 2,097,152 bytes. It is a valid Extensible Markup Language file, generated for this site and checked with an independent parser. Use it wherever you need a 2 MB sample, test or dummy XML file.
Download
sample-xml-2mb.xml
2 MB2,097,152 bytes
Download 2 MB XMLCreated in your browser in a few seconds, then checked against the SHA-256 checksum. No sign-up.
- Type
- application/xml
- SHA-256
f3a8b0d814e2b87cecc1df1c5ea26b289038f1e259da3e6355a011701f7640ae- Delivery
- Created in your browser. Files of 2 MB and more have no direct URL (why).
What is in this file
A <customers> root element holding 6,528 fictional records that mix child elements, attributes and an empty element. An XML comment before the closing tag brings the file to the exact size.
| Elements | 6,528 <customer> records |
|---|---|
| Root element | <customers> |
| Declaration | XML 1.0, UTF-8 |
| Encoding | UTF-8 (ASCII characters only) |
| Line endings | LF |
How the file begins
The opening lines of sample-xml-2mb.xml, exactly as they appear in the file.
<?xml version="1.0" encoding="UTF-8"?>
<customers generator="SampleTestFiles" description="Sample XML file (2 MB) for testing">
<customer id="1" active="true">
<name><first>Mia</first><last>Brennan</last></name>
<email>mia.brennan1@example.org</email>
<address city="Osaka" country="JP"/>
<signup>2023-09-27</signup>
<balance currency="USD">1070.40</balance>
<note>Upgraded after a support call</note>
</customer>
<customer id="2" active="true">
<name><first>Freya</first><last>Okafor</last></name>
<email>freya.okafor2@example.com</email>
<address city="Da Nang" country="VN"/>Preview
Creates the file in your browser and shows its first 64 KB.
Where 2 MB matters
A 2,097,152-byte file: exactly the default upload limit of PHP, and twice the default of nginx and Spring Boot. These are the default limits a file of this size is useful for testing:
| System | Limit | Note |
|---|---|---|
| PHP | 2 MB per uploaded file by default (upload_max_filesize) | A file of exactly 2 MB is accepted; one byte more is refused. |
| nginx | 1 MB by default (client_max_body_size) | Rejected with 413 Request Entity Too Large. |
| Spring Boot multipart | 1 MB per file by default (max-file-size) | Rejected unless the property is raised. |
| Django | 2.5 MB in memory by default | 2 MB is held in memory; the 5 MB sample is streamed to a temporary file. |
| Vercel Functions | 4.5 MB request body | Accepted, including as base64 at about 2.8 MB. |
Use this file for
- Finding out whether a 1 MB default has been raised
- Testing XML parsers and data import
- Checking protection against entity attacks
Testing notes for XML
- Parsers that resolve external entities can be made to read local files or call internal services, an attack called XXE. Disable DTD processing for untrusted input.
- Nested entity definitions can expand exponentially ("billion laughs"). The samples here declare no entities.
Technical details
| File name | sample-xml-2mb.xml |
|---|---|
| Format | XML (Extensible Markup Language) |
| Extension | .xml |
| MIME type | application/xml |
| Size | 2,097,152 bytes (2 MB) |
| Kind | Text |
| Signature | 3C 3F 78 6D 6C |
| SHA-256 | f3a8b0d814e2b87cecc1df1c5ea26b289038f1e259da3e6355a011701f7640ae |
| Created | 2026-10-14 |
| Validation | Exact size, signature bytes and structure checked when the generator was built; your copy is checked against the SHA-256 after it is created |
| Preview | Available on this page |
| Source | Generated in your browser by this site's generator; not copied from elsewhere |
| Licence | Free to use, modify and redistribute (terms) |
| Category | Data |
Validated for expected format and integrity. As with any download, scan the file with your own security tools before opening it. How files are made and checked
Verify your copy
This file is created in your browser, so it has no direct URL for curl or wget. The bytes are the same every time and in every browser, so after saving it you can compare its checksum with the SHA-256 value above.
sha256sum sample-xml-2mb.xml # Linux
shasum -a 256 sample-xml-2mb.xml # macOSOn Windows, run Get-FileHash sample-xml-2mb.xml -Algorithm SHA256 in PowerShell. For scripts and pipelines, save the file once and keep your own copy, or use a 1 MB file, which has a direct URL.
Related files
Questions about this file
- Is this file exactly 2 MB?
- Yes. It is 2,097,152 bytes, which is 2 MB in the binary units that operating systems and server limits use (1 KB = 1,024 bytes).
- What is inside the 2 MB XML file?
- A <customers> root element holding 6,527 fictional records that mix child elements, attributes and an empty element. An XML comment before the closing tag brings the file to the exact size.
- 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.