What is the average disk storage size of a Minecraft chunk?
This answer is updated for 1.13 block format change, see the answer history for older versions of the world storage format
The actual terrain is stored in the region, DIM1 and DIM-1 sub-folders of the world save folder.
Each file there contains up to 1024 (32x32) chunks (you can check out What is a chunk). All chunk in a single file are from what is called a "region" of 512x512 potential blocks. The region file may contain less than 1024 chunks if the region is not fully explored and some chunks are not yet generated.
Since each region is generally explored to a different extent, the sizes of region files can vary wildly and an average number is not very useful. We can however make some estimations for the average size of a fully explored region.
Each chunk is split vertically in 16 sections each 16 blocks high (stacked on top of each other). The game stores information only about the bottom sections where there are blocks. For example if the terrain goes up to y=82, the game will store the bottom 6 sections (6*16=96 height, just enough for height 82) and all blocks above y=96 are implicitly considered to be air and are not stored in the file.
Now we are going to make some assumptions. Let's say:
- the region is fully explored (contains all 1024 chunks)
- the average section height of each chunk is 5 (ocean level is y=64, so this sounds about right)
- we are ignoring tile entities like chests, furnaces, signs etc. (they are relatively small percentage of the terrain)
- we are ignoring entities like mobs, dropped items, arrows, etc. (because they are small number compared to the number of blocks)
This means that the the region file contains 1024 chunks * 5 sections = ~5000 sections.
Each section contains 16 x * 16 z * 16 y blocks = 4096 blocks. To store each block in a section the game gets collects all unique blocks+states in a 'block palette' e.g.
index | block state |
---|---|
0 | name: "minecraft:stone" |
1 | name: "minecraft:water" |
2 | name: "minecraft:water", level: 1 |
3 | name: "minecraft:light_blue_stained_glass_pane", east: "true", south: "true", waterlogged: "true" |
4 | name: "minecraft:air" |
and then stores an array of indices in the palette, e.g. 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 1, 1, 2, 1, 1, 1, 3, 0, 0, 0, ....
The palette itself can vary wildly in size depending on how many different kinds of blocks there are and how complex are they. A section with only solid stone will have one palette entry while a section with a redstone contraption or a market square by your favourite builder can have hundreds of entries.
This means it is time for some more assumptions:
- in natural generating terrain the palette will probably contain up to 10 entries and they will be simple ones like "minecraft:stone"
- we'll say the palette is roughly 500-1000 bytes
- the indices in the palette will thus be 0-9 and each will need 4 bits to be encoded
So in a single section we'll have:
- 500 bytes palette
- 4096 blocks * 4 bits indices in the palette = 2048 bytes for blocks
- 4096 blocks * 4 bits for block light (0-15) = 2048 bytes for block light
- 4096 blocks * 4 bits for sky light (0-15) = 2048 bytes for sky light
One section turns out to be ~6500 bytes. 5000 sections are 32.5 MB
Before being stored in the file, each chunk is compressed with generic gzip compression, which I'll assume reduces the size to about 10% of the original (Typically, chunks are mostly smooth stone and light level 0, but the compression rate can vary a lot depending on what is actually in the chunk).
So our final estimate would be that a fully explored region file is about 32.5*0.1 = about 35MB.
Knowing this we can estimate the size of the whole Overworld by simply calculating (number of explored chunks) * 5 sections per chunk * 6500 bytes * 0.1 compression = (number of explored chunks) * 3500 bytes.
In the Nether, the average sections in each chunk would be 8 (height = 128).
In The End, the average sections in each chunk around the center would be more like 1, because there is a lot of void around the main island.
1.13 brings changes. I believe they're now saving the block ID (or maybe it's the block state, or both) in a palette for each chunk since they've used up all the block IDs with about 256 different block types now. So the palette only contains the block types used in that chunk. Usually 1 byte (8 bits) is enough since 99% of the time you won't have more than 256 block types in a chunk. A chunk can have 16x256x16=65536 possible block types.
The metadata is also now moved to a block state so it is not limited to 4 bits (only 2^4=16 possible states).