Estimate XML document size and compare its overhead against JSON.
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.
XML Size
XML per field = opening tag + closing tag + brackets + value
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.
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.
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.