Spawn

Spawning refers to players and mobs being created and placed in the game world.

World spawn


New players initially spawn within a small area surrounding the world spawn point when the server is not in adventure mode. This area is 21×21 blocks by default, but can be changed by the  gamerule in both single and multiplayer. Upon death,the player respawns within this area unless the player's individual spawn point changed (by sleeping in a bed or using a respawn anchor).

Upon spawning, the player is placed on the highest block of the X and Z spawn coordinates, even if this would set the player above the maximum build height. This area does not consider the existence of a block to spawn on, which can result in players spawning above the Void if there are no blocks at that X and Z location.

The world spawn point also determines the center of the permanently loaded spawn chunks.

The world spawn point itself can be changed using the command.

Bedrock world spawn search
$$, when a player creates a new world, the world spawn point is restricted to specific biomes. The algorithm starts searching from coordinate 0,0 continuing outward until an acceptable biome is found for the world spawn point. Using add-ons, a rare biome can be designated to cause the player to spawn at a distant location, but the game crashes if the biome does not exist or cannot generate.

The algorithm searches for these biomes:
 * At main plains biome
 * Small islands in an ocean (islands are usually a plains biome)
 * Patch of plains next to desert, badlands, or snowy tundra
 * At main forest biome
 * Small islands in an ocean (islands can also be a forest biome)
 * At main taiga biome
 * Patch of taiga next to giant tree taiga
 * Near beach, snowy taiga, or mountains
 * Only regular variants
 * At main taiga biome
 * Patch of taiga next to giant tree taiga
 * Near beach, snowy taiga, or mountains
 * Only regular variants
 * Only regular variants
 * Only regular variants

The player spawns within a 5 block radius of the point selected in the chosen biome, sometimes resulting in the player spawning outside the spawn biome, ending up at as beach, river, or swamp.

A search for a valid world spawn biome is not performed for Flat and Old world-types.

Adventure mode
When the server's settings set the default game mode to adventure mode (using the server.properties), then the normal spawning mechanic is ignored and players are spawned directly on the world spawn. This includes the X, Y and Z coordinates, even if there is no block there and even if there are blocks above it.

If the Y coordinate is not a valid spawning area then the server looks up until it finds one, up to a maximum of Y=256. If there is space to spawn but it is in midair, the player spawns in midair, even falling into the void if there is a hole.

Location
There are several ways to determine the world spawn point:
 * A compass always points to the spawn point.
 * The following works only for players not connected to a bed:
 * In Adventure mode, the block position players spawn on is the world spawn point.
 * In Creative, Spectator, and Survival modes, players spawn on a random block in a 20×20 box centered on the spawn point. The spawn point can be inferred by repeatedly respawning and keeping track of the smallest rectangle encompassing all blocks players have spawned on so far. If the rectangle spawns between  on both axes, the spawn point can be on any integer   between   with equal probability. Once the rectangle has grown to 20×20 blocks, the spawn point is in its exact center.
 * Doing the commands then.
 * Entities other than players falling into the exit portal in the End land on the exact spawn point. Items thrown in mark the spot in the Overworld. Players spawn like they normally do, allowing this to be used to perform the above without dying.
 * Mods or external programs such as NBTExplorer or MCEdit can also be used to find and set the world spawn point.

Individual spawn
The individual spawn point of the player can be changed by sleeping in a bed or using the command. If the individual spawning area of the player is obstructed upon death, the player respawns at the world spawn.

Sleeping in a bed allows for leniency in obstruction, in that the player respawns on other blocks near the bed if the original point becomes blocked. If the spawn point set via becomes obstructed, the player is not given this leniency in respawning.

Natural generation
Many mobs generate upon initial chunk creation. These spawns occur only once per chunk. They are not affected by the command.

Animals


Approximately one in ten newly generated chunks contain mobs, usually in packs of up to four of the same species. They always spawn on the highest available block in a column. For an animal to spawn on it, this block must be opaque and the two blocks above it must be transparent. The block does not need to be a grass block nor does it need to be illuminated as it does with mob spawning.

There are 2 types of animals: common animals and biome specific animals.

Common animal mobs do not spawn in desert, badlands, beach, snowy tundra, river, ocean, and mushroom fields biomes. The weight is the spawn rate for the bedrock codebase.
 * Common animals
 * Weight: 6, 2-3 animals
 * Weight: 5, 2-4 animals
 * Weight: 5, 1-3 animals
 * Weight: 4, 2-3 animals
 * Weight: 5, 1-3 animals
 * Weight: 4, 2-3 animals
 * Weight: 4, 2-3 animals
 * Weight: 4, 2-3 animals

Some animal mobs spawn only in specific biomes.
 * Biome specific animals

Randomness for animal spawning is derived from the world seed, which means that worlds with the same seed always generates chunks with the same animals in the same places.

Monsters
Most monsters cannot spawn on peaceful difficulty. At higher difficulty, most of them prevent the player from sleeping, and most of them spawn at light level of 7 or less.


 * Common monsters

Common monster mobs can spawn in almost any biome in the Overworld (except for mushroom fields). They can spawn on the surface and underground. The weight is the spawn rate in the Bedrock Codebase.
 * Weight: 100, in groups of 2-4
 * Weight: 100, individually
 * Weight: 100, individually
 * Weight: 80, in groups of 1-2
 * Weight: 10, in groups of 1-2
 * Weight: 5, individually
 * Weight: 80, in groups of 1-2
 * Weight: 10, in groups of 1-2
 * Weight: 5, individually
 * Weight: 10, in groups of 1-2
 * Weight: 5, individually
 * Weight: 5, individually


 * Biome-specific monster

Some monsters spawn only in specific biomes.

Other mobs
The mobs still spawn if the command is set to , because they spawn as part of structure generation.
 * Villagers, iron golems, stray cats, pigs, cows, sheep, and horses generate as part of the village generation.
 * Specific animals spawn as part of specific village structures: Animal pens (cow, sheep, pig, or horse), stables (horse, cow, or pig), butcher's houses (pig, cow, or sheep), and shepherd's houses (sheep).
 * Each villager spawns in a house with a bed, and an iron golem spawns as part of meeting points.
 * Zombie villagers can spawn as part of zombie village generation, where they never despawn naturally.
 * Cats also spawn upon generation in abandoned villages.
 * A single witch and black cat spawn within a swamp hut upon generation.
 * Three elder guardians generate as part of a single ocean monument.
 * A single ender dragon is created in the End when the dimension is created. The ender dragon can also be respawned by placing end crystals on the exit portal.
 * Shulkers generate as part of end cities.
 * Vindicators and evokers generate as part of woodland mansions and high level raids.
 * A villager and a zombie villager generate as a part of an igloo if it generates with a basement.
 * Drowned generate as part of some underwater ruins.
 * Illagers spawn from pillager outposts, raids, and patrols.
 * Phantoms spawn whenever a player hasn't slept for 3 or more days.

Java Edition
Mobs are broadly divided into four categories: hostile, friendly, water (e.g. squid), and ambient (e.g. bat). Hostile mobs have a spawning cycle once every game tick ($1/25$ of a second). Friendly and water mobs have only one spawning cycle every 400 ticks. Because of this, where conditions permit spawning, hostile mobs spawn frequently, but passive mobs (ie: animals) spawn rarely. Most animals spawn within chunks when they are generated.

Mobs spawn naturally within a square group of chunks centered on the player, 15×15 chunks (240×240 blocks). When there are multiple players, mobs can spawn within the given distance of any of them. However, hostile mobs (and some others) that move farther than 128 blocks from the nearest player despawn instantly, so the mob spawning area is more-or-less limited to spheres with a radius of 128 blocks, centered at each player. In multiplayer, mob caps are shared by all players, no matter where they are.

Every 24000 ticks (20 minutes) the game attempts to spawn a single wandering trader with two leashed llamas within 48 blocks of a player or at a village meeting place, if no wandering trader exists in the world. The trader does not spawn when the player is underground.‌

Java Edition mob cap
Mob caps are directly proportional to the total number of chunks eligible for spawning. To calculate the cap, the spawning area is expanded by one chunk in every direction (so the default gives 17×17 chunks), then the total number of chunks is plugged into the following formula:

mobCap = constant &times; chunks &divide; 289

The constants for each group are as follows:
 * Monster = 70
 * Creature = 10
 * Ambient (bats) = 15
 * Water (squid, fish, dolphins) = 15
 * Misc = 15

In singleplayer, there are always 289 chunks in range so the constant is always used as the global mob cap.

In multiplayer, the global mob cap grows as more chunks are loaded. As chunks that are in the range of multiple players are counted only once, more chunks and higher mob caps result from the players spreading out more.

The number of mobs is checked once at the beginning of each spawning cycle against the cap. If the number of living mobs in a category is over its cap, the entire spawning cycle for that category is skipped. The area checked for mobs is the same as the area used for calculating the mob cap, which is the spawning area expanded by one chunk in every direction. The mob cap count is separate for each dimension.

Pack spawning


For each spawning cycle, one attempt is made to spawn a pack of mobs in each eligible chunk. A random location in the chunk is chosen to be the center point of the pack. For the pack to spawn at all, the center block must be non-opaque, or must not fill its entire cube, or must be powered.

If the pack location is suitable, up to 12 attempts are made to spawn up to a pack, which is 8 wolves, 1 ghast, 3 rabbits, or 4 of any other mob. The pack is spawned within a 41×1×41 (that's a 41×41 square that is one block high) area centered at the initial block. Mobs spawn with the lowest part of their body inside this area. For each spawn attempt, a block location within the pack area is chosen at random. Though the pack area extends 21 blocks out from the center, the random location is heavily skewed toward the center of the pack. Approximately 85% of spawns are within 5 blocks of the pack center, and 99% within 10 blocks of the center.

All mobs within a pack are the same species. The species for the entire pack is chosen randomly from those eligible to spawn at the location of the first spawn attempt in the pack.

In the Overworld, this depends on the location:


 * Jungle biomes increase the chance to spawn chickens.
 * Badlands biomes spawn only hostile mobs; however, eroded badlands can spawn common animal mobs
 * River and frozen river can spawn only drowned, squid, and salmon underwater. Frozen river biomes also spawn rabbits, polar bears, skeletons, and strays, but not other mobs.
 * Ocean biomes do not spawn common animals. They also spawn drowned and the other hostile mobs. Frozen oceans do not spawn dolphins, but spawn strays and polar bears,
 * Witch huts can spawn only witches, periodically.
 * Ocean monuments spawn guardians only.
 * Pillager outposts spawn pillagers only.
 * Snowy tundra and snowy mountains cannot spawn hostile mobs, other than skeletons and strays.
 * The rest of the locations can spawn common animals, common monsters, slimes, and phantoms. Slimes spawn if they are either in any eligible chunk under layer 40, or in a swamp biome at a low light level, depending on the phase of the moon.

In the Nether, the locations are less varied:
 * Skeletons, wither skeletons, and blazes can spawn within Nether Fortresses.
 * Ghasts can spawn in nether wastes that does not belong to a nether fortress.
 * Zombified Piglin and Piglin can Spawn in nether wastes, while magma cube spawn primarily in Basalt Delta biomes and sometimes in nether wastes.
 * Mobs (excluding zombified piglin and skeleton) that can spawn anywhere in the Nether ignore light level.
 * Hoglins and Piglins and can spawn at a higher rate anywhere in the Crimson Forest biome.
 * Endermen can spawn more frequently in the Warped Forest biome, but not in crimson forest.
 * Skeletons and Ghasts can spawn more frequently in the Soul Sand Valley biome.

Spawn conditions
Each individual spawn attempt succeeds only if all of the following conditions are met:
 * There must be no players and no player spawn points within a 24 block distance (spherical) of the spawning block
 * There must be fewer loaded mobs of that type than the mob cap for that mob.
 * If it is a squid, a guardian, a drowned, a cod, a salmon, a pufferfish, a tropical fish or a dolphin then...
 * the spawning block must contain liquid (water)
 * If it is a squid, then...
 * the spawning block must be between level 46 and 62, inclusive
 * the biome must be Ocean or River
 * the spawning mob must not be obstructed by other mobs
 * If it is a guardian, then...
 * the difficulty must not be peaceful
 * 95% chance of failure if the spawning block has sky exposure (details)


 * If it is not a squid, guardian, a drowned, a cod, a salmon, a pufferfish, a tropical fish or a dolphin, then...
 * the block directly below it must have a solid opaque top surface (this includes upside down slabs / stairs and others) or be soul sand or a slime block
 * the block directly below it may not be bedrock or barrier
 * the spawning block cannot be rails, powered rails, detector rails, or activator rails or redstone components.
 * the spawning mob hitbox must not be obstructed by any other physical hitbox (i.e. other mobs or blocks) or liquid


 * If it is a bat, then...
 * the spawning block must be at level 62 or below
 * If the real-time day is between October 20 and November 3, then the light level must be 7 or darker. Otherwise the light level must be 4 or darker.


 * If it is an animal (other than a mooshroom or ocelot), then...
 * the light level of the spawning block must be 9 or brighter
 * the block directly below the spawning block must be grass


 * If it is a mooshroom, then...
 * the light level of the spawning block must be 9 or brighter
 * the block directly below the spawning block must be mycelium


 * If it is an ocelot, then...
 * the spawning block must be above level 63
 * the block directly below the spawning block must be grass or leaves
 * there is a $1/5$ chance for the spawn to fail


 * If it is a hostile mob (except as noted below), then...
 * the difficulty must not be peaceful
 * the light level of the spawning block must be 7 or darker (with exception during thunderstorms), and more light increases the chance for the spawn to fail
 * sunlight falling on the spawning block further increases the chance for the spawn to fail, by up to 50%


 * If it is a slime, then...
 * the light checks in the general hostile mob check don't apply
 * one of the following must be true:
 * option 1:
 * the spawning block must be in a chunk eligible to spawn slimes (see the slime page for details)
 * the spawning block must be below level 40
 * 90% chance of failure
 * option 2:
 * the spawning block must be in a swamp biome
 * the spawning block be on level 51 through 69 inclusive
 * chance of failure based on the phase of the moon
 * the light level of the spawning block must be 7 or darker, and more light increases the chance for the spawn to fail
 * 50% chance of failure


 * If it is a ghast, then...
 * the light checks in the general hostile mob check don't apply
 * there is a 95% chance of spawn failure


 * If it is a magma cube or zombie pigman, then...
 * the light checks in the general hostile mob check don't apply


 * If it is a blaze, then...
 * the light checks in the general hostile mob check don't apply
 * the light level must be 11 or darker


 * If it is a skeleton in a Nether fortress, then...
 * there is an 80% chance of spawning a wither skeleton instead


 * If it is a drowned a $8/10$ chance must succeed for oceans, while a $1/10$ chance must succeed for rivers
 * In ocean biomes, drowned spawn at a height less than 5 blocks below sea level

If all of these conditions are met then the mob is spawned. The pack is complete when 4 mobs have spawned (or 8 wolves, or 1 ghast, or 3 rabbits), or 12 attempts have been made, whichever comes first. The exception(s) to these rules is the ender dragon or the wither.

Bedrock Edition
Natural spawning $5/10$ shares some similarities to natural spawning in Java Edition. In Bedrock Edition, there are two main types of natural spawns: pack spawns and structure mob spawns. Structure mob spawns are mobs spawned as part of a structure, such as nether fortresses, witch huts, etc. Pack spawns account for all other types of natural spawns, including mobs that spawn individually (i.e. not in a pack of 2 or more). Both types of natural spawns follow the same rules for spawn conditions and the mob cap, however most animal can spawn at light level 7 or higher rather than 9 or higher.

Mob spawning is evaluated for every chunk within a 6 chunk cylindrical radius of the player that is ticked; if the simulation distance is smaller than 6 chunks, then only chunks within the simulation distance can spawn mobs. There is a $4/10$ chance of the mob spawning algorithm attempting to run per chunk, per-tick.

Bedrock Edition mob cap
There are two main mob caps that affect spawning: a global mob cap and a mob density cap. The global mob cap for natural spawns is set at 200 regardless of difficulty. The global mob cap affects only natural mob spawning, and does not affect mobs spawned through breeding, spawn eggs, the command, monster spawners or any other type of mob spawning. Only mobs that are within ticking areas (both those around players and those set manually using the command) count toward the global mob cap; mobs not ticked do not count toward the global mob cap. Mobs can also have their own individual cap listed below:

Alongside the global mob cap is a mob density cap. The mob density cap limits how many mobs of each type and category can spawn within a 9&times;9 square region surrounding each chunk eligible for spawning. Mobs in chunks outside a ticking area count toward the mob density count. The density cap is split up into two distinct categories: a cap for surface mobs, and a cap for cave mobs. Cave mobs do not count toward the surface mob cap, and surface mobs do not count toward the cave mob cap. Whether a mob counts as a surface mob or a cave mob is determined by where it spawned, not where it happens to be at the moment.

There are four categories of mobs: ambient, animal, monster, and water. The mob density cap for each category and location of mob in each dimension is as follow:

Spawn conditions
The following rules apply to all mobs:
 * Can spawn only between 24 and 54 blocks spherical radius from the player.
 * Cannot spawn if the block below them is air (except for Phantoms).
 * Cannot spawn if that mob would collide with an existing mob.
 * Cannot spawn on bottom half of slabs or carpet.

Some additional rules apply to specific categories of mobs.

For water mobs:
 * Cannot spawn outside of liquid.

For monsters:
 * Cannot spawn if the light level is greater than 7.

For non-water mobs:
 * Cannot spawn on bedrock or invisible bedrock.
 * Cannot spawn touching any liquid.

Pack spawning
Pack spawning happens in two stages: first attempt to spawn surface mobs, then attempt to spawn cave mobs. Before spawning, the mob density cap is calculated based on the 9x9 square area surrounding the current chunk. Spawning begins by picking a random X and Z location within the chunk currently being evaluated. The Y coordinate is determined by starting at the world height and searching downward for the next block of a certain type with a non-solid block above it. The first such block that is found is considered to be the surface, and the algorithm attempts to spawn a surface mob pack. The algorithm then continues to search downward for the next suitable block with a non-solid block above it. When a block meeting the criteria is found, the algorithm attempts to spawn a cave mob pack at that block location. Cave spawn attempts continue until the Y coordinate reaches the world bottom, and do not stop even if a cave pack was spawned.

Surface and cave pack spawn attempts then go through the following steps to figure out what mob to spawn and how many:


 * 1) Picks a random mob.
 * 2) * If the current spawn location is in a liquid, pick a random water mob.
 * 3) * If the light level is greater than 7, there are no other blocks above the current location, and the current location is a grass block, pick a random animal mob.
 * 4) * Otherwise, spawn a monster mob.
 * 5) Picks a random number of mobs to spawn in the pack. Each mob can have its own min and max pack size, and the pack size can depend on difficulty.
 * 6) Make sure the spawn location has suitable spawn conditions.
 * 7) Limit the number of mobs spawning based on the global mob cap. No mobs spawn if the mob count already meets or exceeds the mob cap.
 * 8) For each mob to spawn, check that spawning it would not exceed the mob density cap.
 * 9) * If spawning the mob would not exceed the mob density cap, then the probability of a mob spawning can be calculated using the formula:
 * 10) Finally, attempt to spawn the mob in the world.
 * 11) * Spawning the mob can fail; for example, if spawning it would cause it to spawn inside of a block or part of a wall.

Other types of spawning

 * Cows, chickens, pigs, sheep, mooshrooms, villagers, ocelots, wolves, horses, llamas, donkeys, rabbits, pandas, cats, foxes, turtles, and bees can breed. All of these require a player to breed them except for villagers and turtles.
 * A thrown egg has a $1/10$ chance of spawning a chicken, and an additional $8/10$ chance of spawning 4 chickens from a single egg, so there is a total of $8/10$ chance for a single thrown egg to spawn 4 chickens.
 * A snow golem, iron golem, or wither can be made to spawn if a player builds the proper structure out of blocks. Iron golems can also spawn in sufficiently populous villages. See their respective pages for full details.
 * An infested block spawns a silverfish if broken, or if a nearby silverfish is attacked.
 * Zombies can spawn in large groups in villages at midnight if the player is within the village, ignoring some of the usual restrictions, forming a siege. The game makes 20 attempts to spawn a zombie within a 17×17×17 area centered on a block within the village's cylindrical radius, at the same Y level as the village center.
 * Zombie pigmen can spawn from nether portals in the Overworld. Lighting and player proximity don't prevent this.
 * Endermites can spawn randomly when a player uses an ender pearl.
 * Killing medium and large slimes and magma cubes spawn more of them, but in a smaller size.
 * When a pig gets struck by lightning, it is replaced by a newly spawned zombie pigman.
 * When a villager gets struck by lightning, it is replaced by a newly spawned witch.
 * If a creeper gets struck by lightning, it becomes charged.
 * A monster spawner causes mobs to spawn constantly in the area around it. Spawners may naturally generate spawning zombies, skeletons, spiders, cave spiders, silverfish, or blazes, but may be made to spawn other mobs using commands or spawn eggs. Mobs have the same spawning conditions they would have from a natural spawn, except hostile mobs may spawn without a block below them.
 * Turtle eggs hatch and spawn baby turtles.
 * Zombies, illagers, and zombie pigmen can spawn reinforcement when hurt.
 * Skeleton horse can spawn during thunderstorm.
 * Zombie villagers spawn as 5% of naturally-spawning zombies
 * A villager killed by a zombie has a 50% chance of becoming a zombie villager in normal difficulty, and 100% chance in hard difficulty.
 * Skeletons spawn as 20% of naturally-spawning strays.
 * Zombies spawn as 20%/30% of naturally-spawning husks.
 * Baby zombies, zombie pigmen, drowned, husks, and zombie villagers have a 15% or 5% chance of spawning as chicken jockey.
 * Spiders and cave spiders have 1% chance of spawning as spider jockey
 * Vindicators, evokers, pillagers, ravagers, and witches can spawn as part of raids.
 * Phantoms spawn after player fails to sleep for at least 3 days.
 * Cats spawn based on the number of beds in village.
 * A brown mooshroom spawns when a red mooshroom is struck by lightning or vice versa.
 * Patrols consist of vindicators and pillagers. $5/10$, patrols can spawn like regular monsters. $4/10$, patrols can spawn in any biome except in the End, the Nether and mushroom fields; they even spawn in biomes where common monsters cannot spawn, such as in legacy frozen ocean.
 * Cod, salmon, pufferfish, and tropical fish spawn when using the corresponding bucket of fish.
 * In Creative, the player can use spawn eggs to spawn most mobs. When mobs are spawned this way, all normal spawning requirements, such as light level and block type, are ignored. (Though monsters other than vindicators, evokers, shulker, and ender dragon still cannot be spawned in peaceful)
 * An agent spawns when using a code connection.
 * Any entity can be spawned using the command.
 * Breaking a bee nest or beehive spawns bees when broken.

Java Edition


Hostile mobs (other than villagers that were converted to zombie villagers), chickens from chicken jockeys, monsters, despawnable mobs (including bats, squid and ocelots) (after having existed for over 2400 ticks), and hostile wolves can cease to exist, or "despawn", under certain conditions:


 * A mob that has had no player within 32 blocks of it for more than 30 seconds has a $1/10$ chance of despawning on each game tick ($2/40$ of a second), which is a 2.47% chance per second. Therefore, the average lifetime of monsters not within 32 blocks of a player is 40 seconds (after the initial 30 seconds have elapsed).
 * A mob despawns immediately if no player is within 128 blocks of it.
 * Note that this is a Euclidean sphere, not a cylinder from map top to bottom and not a taxicab sphere (which is more like an octahedron). Example: A mob at 0/y/0 remains at least 30 seconds (as above) if the player moves to 65/y/65 (real distance 91.9), but despawns immediately if the player moves to 91/y/91 (real distance 128.7).
 * The chunk the mob is in must still be loaded to the mob to despawn. Otherwise, the mob is frozen until the chunk is loaded again when the player approaches it, and possibly find the same mob again. Because the chunks loaded form a square around the player (if there is only one) while the distance needed for the despawning to happen is the euclidean one, moving in a diagonal direction compared to X/Z axes, and possibly taking some vertical distance, can help keeping the chunks loaded and make the monster despawn. Also, improving rendering distance helps, as this makes the game load more chunks.
 * All hostile mobs (including those that are holding items) in a world despawn if the difficulty is set to Peaceful, regardless as to where the player is positioned in the world.
 * In multiplayer, despawning does not occur while there are no players in the game.
 * A monster that has been named with a name tag never despawns. However, one created from a renamed spawn egg does despawn as normal.
 * If a monster holds any items or wears any armor that was given by a player or picked up from the ground, it does not despawn.
 * Chickens that originally spawned as chicken jockeys follow zombie despawn rules, rather than chicken despawn rules.

Bedrock Edition
In Bedrock Edition, each loaded chunk has a $1/40$ chance each tick of trying to despawn an entity. If selected, a random entity in the chunk is chosen and despawned, subject to all of the following conditions:


 * The entity is more than 54 blocks circular radius away from the nearest player.
 * The light level is lower than 8.
 * For monsters, the light level is greater than 8, and if it is a surface mob, it is day time.
 * The entity is older than a certain age (the exact age is unknown and may depend on the type of entity).
 * The entity does not have persistence (see below).

Persistence
$4/10$, entities with persistence do not despawn naturally. Entities are given persistence in the following situations:


 * The entity interacts with a player:
 * Is ridden by the player.
 * Is named with a name tag.
 * Is tempted with food.
 * Is bred, or born as a result of breeding.
 * Is tamed by the player.
 * Attacks or is attacked by the player.
 * Touches the player.
 * The entity is spawned by:
 * Using a spawner.
 * Using a spawn egg.
 * Using the command.
 * Curing a Zombie Villager (spawns a Villager).
 * Triggering a skeleton trap (spawns Skeletons and Skeleton Horses).
 * The entity is spawned during generation of a certain kind of structure:
 * Shulker spawned in an End City.
 * Witch spawned in a Witch Hut.
 * Villager or Zombie Villager spawned in an Igloo.
 * Zombie Villager Spawned in A Zombie Village.
 * Vindicator spawned in a Woodland Mansion.

The following entities always have persistence:
 * Ender Dragon
 * Wither Boss
 * Elder Guardian
 * Guardian
 * Iron Golem
 * Snow Golem
 * Villager
 * Armor Stand
 * Agent

Trivia

 * In older versions, it is possible for the spawn point of a world to be in a lava lake, in which case starting a game in Survival is nearly impossible unless there is water nearby. This was fixed in 1.9, so that lava lakes fail to generate in the world spawn area.
 * The world spawn (the point where players spawn if they have no valid bed spawn) is usually a random (seed determined) point between -500 and +500 on the X and Z axis. If the chosen point is in water (due to nothing but ocean biomes in the -500 to +500 range), a second attempt is made between -1500 to +1500. If this fails due to ocean, the game gives up and puts the world spawn in the middle of the ocean (still at the surface) (attempting to play the flat lands preset Water World does this, for example). Normally, a player who spawns in the water does so near the shore because the world spawn itself picked a spot there.
 * An opaque block normally causes all blocks below it to spawn cave mobs, but not if a transparent block is placed on top. This can be exploited for [ certain mob farms].