Monster Spawner

A monster spawner or spawner is a block that can spawn mobs.

Obtaining
Spawners cannot be obtained in survival. They can be mined quickly with a pickaxe and will drop some experience, but if they are mined without a pickaxe it will take longer and they will drop nothing.

It is also not found in the creative inventory, and is the only block that cannot be picked with. It can only be obtained using the command.

Natural generation
Spawners can generate naturally in these places, spawning mobs chosen randomly when generated:
 * Dungeons
 * Placed in the center of the dungeon. It may be a zombie spawner (50% chance), skeleton spawner (25%), or spider spawner (25%).


 * Abandoned mineshafts
 * Cave Spider spawner heavily surrounded by cobwebs.


 * Woodland mansions
 * Spider spawner heavily surrounded by cobwebs in a rarely generated secret room.


 * Strongholds
 * Silverfish spawner. Located in the end portal room. One per stronghold.


 * Nether fortresses
 * Blaze spawner. Located on nether fortress balconies with stairs leading up to them. Normally two per fortress.

Usage
The spawner spawns mobs in an 8*8*3 area around it when the player is within 16 blocks. Suitable spawning locations for the block's mob type are provided in the area. The spawner will attempt to spawn 4 mobs around it, then wait from 10 to 39.95 seconds before spawning more.

When obtained as an item and placed, it will spawn pigs by default in Java Edition, or will appear empty in Bedrock Edition.

The spawned mob can be changed by a spawn egg on the spawner.

In Peaceful difficulty, spawners will still appear and work, but any spawned hostile mobs will disappear the instant they spawn. Zombie pigmen, magma cubes, and ghasts will not spawn at all.

Spawners are transparent in their rendering only - unlike most other transparent blocks, they can have torches and redstone components placed on them, conduct a redstone current, suffocate mobs, and more.

Spawners cannot be moved by pistons.

Mechanics
A spawner is only active when a player is within a radius of 16 blocks. While the block is active, it will spawn mobs within an 8×8×3 block volume (8 wide, 8 long, and 3 high) centered on the center of the block, effectively meaning mobs can spawn in a 9×9 area, or 3.5 blocks from the spawner. Mobs can spawn anywhere in this range that is suitable, with mobs more likely to spawn closer to the spawner than farther away. A spawner of a mob that only spawns in dark conditions will not spawn mobs in any blocks where the light level is higher than 7.

While mobs are spawned at fractional x and z-coordinates (i.e. not aligned to blocks), they are spawned at an integer y-coordinate. Horizontally, a mob can spawn with its center point anywhere within the 8×8 range, but vertically, mobs will spawn with their legs at either the same layer as the spawner block, one block above it, or one block below it.

For some types of mobs to spawn in the outer planes of the spawning volume, some planes outside the volume may also need to be free of opaque blocks to conform with the mobs' height, width, or other rules governing their individual spawn volumes. For mobs that are two or more blocks tall such as zombies, skeletons, or blazes to spawn in the top y-layer, the layer above that must contain only air.

For all of the volumes listed in the table, the horizontal plane is centered on the center of the spawner block. While the spawning volume for pigs is 8.9×8.9×2.9, the requirement of grass blocks that are necessary for pigs to spawn will reduce the actual volume in which they successfully spawn, however other mobs can spawn in mid-air, ignoring general rules about spawning on solid ground.

A spawner does not have to be within 4 blocks of the correct biome for it to spawn biome-specific mobs. As such, spawners can place mobs where they normally wouldn't generate. For example, a mooshroom spawner will operate in a plains biome as long as there are mycelium blocks within the spawn area.

The block will attempt to spawn 4 mobs at randomly chosen points within the spawning area, then wait anywhere from 200 to 799 ticks (10 to 39.95 seconds) before spawning again. As it waits, the mob inside the block will spin faster and faster. Except for spawning on a solid block, all of the usual requirements for spawning must be met (not in a solid block, correct light level, etc.), so the spawner will often produce fewer than 4 mobs. When it does spawn, it will "poof", and more lightless flames will temporarily appear around the Spawn block. If the block fails to spawn any mobs because it did not pick any suitable locations, it will repeat this process every tick until it succeeds. Only when it manages to spawn at least one mob will it start waiting for the next cycle. If, at the time of spawning, 6 or more mobs of the spawner's type are present within a 9×9×9 area centered on the spawner block (in Java Edition) or a 16×10×16 area centered on the lower northeast corner of the spawner block (in Bedrock Edition), the spawner "poofs" without creating any mobs and then waits for the next cycle.

When mining near a spawner that has no valid places to spawn, sometimes a monster will spawn immediately after a block is mined.

Custom spawners
Spawners are capable of much more than they are used for in survival Minecraft. Using commands, they can be customized in many ways:
 * They can be made to spawn any kind of entity.
 * A single spawner can spawn multiple different entities, chosen at random from a list.
 * Properties can be set on the spawned entities.
 * Various range and timing properties of the spawner can be changed.

Detailed technical information about custom spawners can be found below.

Block entity
A monster spawner has a block entity associated with it that holds additional data about the block. The block's block entity ID is.

Trivia

 * Spawners containing zombies or skeletons have a chance for the mob spinning inside to have armor.
 * Spawners in Mushroom Island, Mushroom Island Shore or The Void biome can function normally, despite those biomes having no hostile mobs spawn naturally.
 * Although in Bedrock Edition a spawner emits light level 3, the only effect on gameplay is to make an inactive spawner slightly more visible in a very dark area because mob spawning and crop growth effects are always the same for light levels 0-3.