XML Size Calculator
Estimate XML document size and compare its overhead against JSON.
About XML Size Calculator
XML repeats every element name twice because of closing tags, which roughly doubles the naming overhead against JSON. On records with many short fields that overhead can exceed the data. The size difference narrows considerably after gzip, since both formats compress their repeated names well, so the practical gap is smaller than the raw figures suggest.
Formula
XML Size
XML per field = opening tag + closing tag + brackets + value
- closing tag
- XML repeats the element name to close it, unlike JSON
Worked example
With the default values below, XML Size Calculator returns Total XML Size of 2.8944. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Number of recordsminimum 0
- 5,000
- Fields per recordminimum 0
- 12
- Average tag name lengthminimum 0
- 12
- Average value lengthminimum 0
- 18
Results
- Total XML Size
- 2.8944 MB
- Bytes per Record
- 607.0 bytes
- Equivalent JSON Size
- 2.0218 MB
- XML Overhead Against JSON
- 43.16%
- Size Consumed by Tags
- 1.6594 MB
Step by step
- 1Values used
- 2XML Size
- 3Total XML Size= 2.8944 MB
- 4Bytes per Record= 607.0 bytes
- 5Equivalent JSON Size= 2.0218 MB
- 6XML Overhead Against JSON= 43.16
- 7Size Consumed by Tags= 1.6594 MB
Assumptions and limits
- The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 4 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
How is XML Size calculated?
XML per field = opening tag + closing tag + brackets + value XML repeats every element name twice because of closing tags, which roughly doubles the naming overhead against JSON. On records with many short fields that overhead can exceed the data.
Why does XML Size matter?
The size difference narrows considerably after gzip, since both formats compress their repeated names well, so the practical gap is smaller than the raw figures suggest.
What values do I need to enter?
This calculator takes 4 inputs: Number of records, Fields per record, Average tag name length, Average value length. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.
