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 giving a much higher quantity 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) above the spawning surface, which must be solid and flat (but not a slab).

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

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 will start 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 will not cause a new iron golem 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.

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

Village separation
Creating more villages will increase the spawn rate. Increasing the number of beds beyond 21 will result 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 can resolve the issue. 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 only detect the correct villages by taking advantage of their 32 blocks detection range.

Village center
A village center is on a POI (point of interest). When the village has a bed, bell and a workstation the center would be the bed. When it only has a bell or workstation the bell or the workstation would be the center. Iron golems can spawn at a 17×6×17 area around the village center — 8 blocks horizontally in all directions from the center block, and 1 block above and 4 blocks below the bottom of the center block.

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

Bugs
There is a bug 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.

Next up, there is a bug where 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 nearby workstation can prevent the villagers from linking to workstations that are far away.

In 1.13, stacking villages is no longer possible. Mojang stated that they're looking at getting iron farms fixed.

Stacking villages was never mentioned in the official changelog. Without stacking villages, villages can only produce up to 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

 * WeirdWilliam's Iron Farm 1.14


 * DocM's Iron Farm


 * Frilioth's 1.14.3 Iron Farm

Bedrock Edition videos

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


 * Oare TV's Iron Farm (4 villages)


 * Build tutorial for the farm above


 * Explanation on stacked villages


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