7

Minecraft stores world data per region (512x512 blocks) in compressed .mca files. That means that 1 region is equal to 1024 chunks. What, roughly, is the approximate memory size of a chunk as a part of a .mca file?

1
  • If you have little space left on your HDD, you might consider moving less-used contents to an external drive. Minecraft has a huge range of disk space it uses depending on how much you explore your world, mod, etc. – Patrick Roberts Apr 27 '16 at 18:26
14

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.

5
  • Does the file format look the same in the Nether? I mean, blocks above set height can't be implicitly considered to be air. Either way, great answer. – Deltharis Apr 28 '16 at 8:34
  • The Nether uses exactly the same format only the height there is always 128 blocks (8 sections). Blocks above y=127 are considered implicitly air. If you go above the nether roof and build a gold farm there, some chunks will have more than 8 sections. – Kcats Apr 28 '16 at 8:58
  • This answer is out of date as of 1.13 (blocks are no longer stored as numbers) – pppery Aug 29 '18 at 21:49
  • 1
    @pppery finally updated the answer for 1.13 block format change – Kcats Feb 2 at 9:02
  • Thanks for the update! This happens to come in handy for a project I recently started. I'll try to get some actual statistics for chunks/regions with various amounts of "things in them". – RudolfJelin Feb 2 at 23:46
5

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).

1
  • And I would expect that the block state is also stored in the block palette. – David Callanan Aug 2 '19 at 17:59
1

Minecraft worlds are using the mcanvil(.mca) format. This format stores each block with 12 bits. That would make 49152 bits or 6144 bytes on an 16x16x16 block area. That would make 96MB as a maximum size on an 32x16x32 chunk area per mcanvil-file. This format is used since as I know release 1.0.

Let me know if I'm wrong.

1
  • Interesting. Thanks for defining a theoretical maximum to the chunk size. This will be handy when working with densely-built-in chunks. – RudolfJelin Feb 2 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.