Chunk

Chunks are 256 block tall 16 × 16 segments of the Minecraft worlds. Chunks are the method used by the world generator to divide maps into manageable pieces.

Generation
Chunks are 16 blocks wide, 16 blocks long, and 256 blocks high, which is 65,536 blocks total. Chunks are generated around players when they first enter the world. As they wander around the world, new chunks are generated as needed.

Chunks are generated with the help of the map seed, which means that the chunks are always the same if you would use the same seed again, as long as the map generator and version number remain the same.

Loaded and unloaded chunks
Chunks near the player are loaded into memory. The range depends on the Render Distance setting. These chunks may have activity (mobs spawning, trees growing, water flowing, dropped items disappearing etc.), while chunks outside of the range are inactive, and are stored on the disk. Chunks will not save again if they were saved in the last 30 seconds.

In multiplayer mode, a grid with a default inradius of 10 (for a total of 21x21 or 441) chunks is loaded around each player and sent to the player by default, although this can be configured to be between 3 and 15, usually only lowered with a poor connection home server.

Spawn chunks
The chunks in the area immediately surrounding the world spawn point are special chunks that are never unloaded from memory as long as at least one player is in the Overworld. This means that things like redstone mechanisms and mob farms will continue to operate even when all players are very far away.

Effects on performance
Chunks are normally loaded into volatile memory only when they are needed for displaying. This 'store until needed' memory management is commonly used in games with procedurally-generated terrain so that the players' computers don't have to track and update hundreds of plants and mobs simultaneously.

Minecraft's render engine uses OpenGL's display list feature to divide a world chunk into sixteen 16x16x16 blocks large display lists to speed up rendering significantly. They need to be rebuilt each time when a block within them is changed and can be rendered multiple times to achieve e. g. transparency.

Slime spawning
Slimes can only spawn in specific chunks, determined by a calculation performed on the chunk coordinates. There are a number of utilities and mods that allow the player to tell which chunks they can spawn in.

Finding chunk edges


The key can be used to display chunk boundaries.

Alternately, pressing the "F3" button opens the Debug screen which shows the player's X, Y, and Z coordinates, in addition to the "c" variable. These coordinates will change as the player moves around. The player can know which chunk they are in by the variable "c" that is next to both "x" and "z" variables. The number in the brackets specifies how far the player is from the north-western corner of the chunk, so if the "c" beside X was 3(5), and the "c" beside Z was 2(4), then the player is on chunk (3, 2), and is on block (5, 4) from the north-western corner.

X and Z coordinates that are divisible by 16 represent the boundaries between chunks. EG: (96, -32) is a corner where four chunks meet. One of those chunks is between X coordinates 80 to 96 and Z coordinates -48 to -32. Another one is between X coordinates 96 to 112 and Z coordinates -32 to -16, and so on. When either X or Z crosses a multiple of 16, the player is moving across chunks.

Essentially, the player is in the top-left corner (north-western) of a chunk when both x and z coordinates are divisible by 16.

Additionally, the player can know which chunk they are on by this formula: The X of chunk will be Floor( X coordinate / 16 ) The Z of chunk will be Floor( Z coordinate / 16 ) Where Floor is the largest previous integer. E.g. Floor( 27.9561 ) is 27 In other words if X was 27, Z was -15 the chunk will be chunk ( Floor( 27 / 16 ), Floor( -15 / 16 ) ) which means the player is on chunk (1, -1) Also, The player can know how far he is from the north-western corner by this formula: (X or Z coordinate) AND 15

In Bedrock Edition, when toggling fancy graphics, the world will render again, loading only the chunk the player is in for a split second. This method is useful for finding chunk boundaries as there will be a clear line visible in that split second.

Trivia

 * There are a possible fourteen trillion (14,062,500,000,000) real chunks that can be generated. There are 7.46&times;10244,700 possible chunks, excluding entities.
 * If a player stands in a chunk that has not generated yet, the world immediately becomes invisible until they are in a valid chunk. This does not happen if the Y coordinates are beyond the chunk boundaries.
 * $$, if one of the sixteen 16x16x16 sections of a chunk doesn't have any blocks in it, placing a block there will show the same animation as a chunk loading. This bug makes the block that the player placed turn to the same color of the sky in the direction the player is facing for about 1 second and starts fading away into the normal block texture. If the time is sunrise or sunset and the player places a block there, it will actually change colors constantly for 1 second if the player keeps bobbing their head up and down. The block also makes blocks behind it appear invisible.
 * Placing or destroying a block in an unloaded chunk will usually reload it.