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 XML

Direct download. No sign-up and no waiting.

Type
application/xml
SHA-256
e659c012f431a0dca8e67f57bcd09f337578fc6ba6c15d46ac8fe6b061e8d379
Direct URL
https://sampletestfiles.com/downloads/xml/sample-xml-2mb.xml

What is in this 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.

Elements6,527 <customer> records
Root element<customers>
DeclarationXML 1.0, UTF-8
EncodingUTF-8 (ASCII characters only)
Line endingsLF

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>Ethan</first><last>Zeller</last></name>
    <email>ethan.zeller1@example.com</email>
    <address city="Jaipur" country="IN"/>
    <signup>2021-07-10</signup>
    <balance currency="USD">2769.84</balance>
    <note>Billing contact changed recently</note>
  </customer>
  <customer id="2" active="true">
    <name><first>Elena</first><last>Underhill</last></name>
    <email>elena.underhill2@example.net</email>
    <address city="Porto Alegre" country="BR"/>

Preview

Shows the first 64 KB of the file.

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:

SystemLimitNote
PHP2 MB per uploaded file by default (upload_max_filesize)A file of exactly 2 MB is accepted; one byte more is refused.
nginx1 MB by default (client_max_body_size)Rejected with 413 Request Entity Too Large.
Spring Boot multipart1 MB per file by default (max-file-size)Rejected unless the property is raised.
Django2.5 MB in memory by default2 MB is held in memory; the 5 MB sample is streamed to a temporary file.
Vercel Functions4.5 MB request bodyAccepted, including as base64 at about 2.8 MB.

All 2 MB sample files

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.

XML format reference

Technical details

File namesample-xml-2mb.xml
FormatXML (Extensible Markup Language)
Extension.xml
MIME typeapplication/xml
Size2,097,152 bytes (2 MB)
KindText
Signature3C 3F 78 6D 6C
SHA-256e659c012f431a0dca8e67f57bcd09f337578fc6ba6c15d46ac8fe6b061e8d379
Created2026-10-10
ValidationExact size, signature bytes and structure checked when the file was generated
PreviewAvailable on this page
SourceGenerated for this site; not copied from elsewhere
LicenceFree to use, modify and redistribute (terms)
CategoryData

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

Download from the command line and verify

Fetch the file with curl, then compare its checksum with the SHA-256 value above.

curl -o sample-xml-2mb.xml 'https://sampletestfiles.com/downloads/xml/sample-xml-2mb.xml'
sha256sum sample-xml-2mb.xml     # Linux
shasum -a 256 sample-xml-2mb.xml # macOS

On Windows, run Get-FileHash sample-xml-2mb.xml -Algorithm SHA256 in PowerShell. A matching value proves that the download is complete and unaltered.

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.