Tutorials/Iron golem farming

Iron golem farming uses village mechanics to produce iron, as well as byproducts such as poppies and string. Usually, an iron golem farm is a player-constructed village in which golems are spawned and then either killed immediately or moved to a holding cell outside the village boundary for later killing. Iron golem farming is preferable to other methods of iron farming from zombies and skeletons due to a chance of iron dropping and therefore much higher quantities of iron.

Overall spawning requirements
An iron golem needs an available volume in which to spawn. There must be at least 3 transparent blocks (preferably air, though other transparent blocks like glass also work) above the spawning surface, which must be solid and flat (but not a slab).

Cat cap
Villages spawn cats also, one cat for every four valid beds and one villager. The cat population is capped at 10 cats per village. Neither iron golems nor cats can spawn once the cat cap is reached. Because your farm starts producing cats before it's ready to produce iron golems, you must be sure that your farm kills enough cats to keep the population under 10. A few cats hanging around doesn't present a problem, but you should occasionally patrol the area for cats hiding and other places where they may go or get stuck, and kill them. If the cap is reached, cats must be killed near enough to the villagers (preferably within 16 blocks) so that the villagers are aware that the cat has died, or they don't resume causing new iron golems to spawn. Villagers won't notice the death of cats that have wandered off too far or fallen off a cliff and are still hanging around below. If the cat cap has been reached, killing cats too far away has no effect, and iron golems cannot resume spawning.

Java Edition
In Java Edition, a villager may attempt to spawn an iron golem if it enters a state of panic upon seeing the same zombie as two other villagers within 10 blocks, while not having a golem alive within 16 blocks. The villagers must have worked and have slept before the golem can spawn.

When villagers spawn a golem, they wait 30 seconds for the golem to kill the zombie. If the zombie still exists, they wait an additional 5 seconds and then spawn another golem.

The villagers may also spawn an iron golem even if they are not panicking, but the chance is a little lower. Also, they have to work and sleep after to spawn another golem.

Spawning requirements
A village that consists of: Additional beds or villagers do not affect the spawn rate (32 iron ingots/hour).
 * 21 beds
 * 10 villagers who claimed beds

Village separation
Creating more villages increases the spawn rate. Increasing the number of beds beyond 21 results in the beds being linked to the same village instead of forming a new one. Increasing the number of villages might also result in the villagers linking to the wrong village.

Stacking villages may resolve the issue (unclear if this works since 1.13). To prevent beds from linking to the same village, an additional 32 unclaimed beds should be placed at the original village to trigger the formation of a new village. And to prevent villagers from detecting the wrong village, make sure that they detect only the correct villages by taking advantage of their 32 blocks detection range.

Village center
A village center is the northwest bottom corner of a point-of-interest (POI) block, which can be a bed pillow or bell, or workstation and bell if there are no beds. Iron golems can spawn in a 16×5×16 volume around the village center point; that is, 8 blocks in all horizontal directions from northwest bottom corner of the POI block, and 2 blocks above and 3 blocks below the bottom of the POI block.

The village center might shift if villagers lose access to their claimed beds or the population of the village changes. To prevent the village center from shifting, place water on the feet of a villager who can't access its bed.

Bugs
There is a bug (apparently fixed in 1.13) that sometimes causes golems to spawn stuck partway in the ground with its head visible above ground. Typically when this happens, they are spawning 2 or 3 blocks below the village center, but the ground is higher and valid as a spawn platform. Making the spawn platform 2 or 3 blocks below the village center avoids this problem.

bug reports that cats don't always die on magma blocks. To solve this, place carpets on top of the magma blocks.

There's also a bug where the village expands thousands of blocks from the actual village boundary. Linking the villagers to a nearby workstation can prevent the villagers from linking to workstations that are far away.

Stacking villages was never mentioned in the official changelog. Without stacking villages, villages can produce up to a maximum of 32 iron ingots/hour. See MCPE-47157.

Legacy Console Edition
Iron golem farms in Legacy Console Edition (as well as Java and Bedrock before the Village & Pillage update), are based on doors. Iron golems spawn in a 16×6×16 volume centered on the geometric center of at least 21 doors with at least 10 villagers nearby.

Java Edition videos

 * Rays Works' Quick, Simple Iron Farm


 * Wattles' 1.14.4+ Iron Farm


 * DocM's Iron Farm


 * Frilioth's 1.14.3 Iron Farm


 * BlendsCraftTV Iron X

Bedrock Edition videos

 * Village mechanics describing the mechanisms by which iron golems spawn in villages


 * Oare TV's Iron Farm (4 villages)


 * Explanation on stacked villages


 * 0ld Guy's Modular Stacked Iron Farm build tutorial (9 villages)