Farming

How to Build a Mob Farm in Minecraft (Gunpowder & XP)

A mob farm is the single best "set it and forget it" machine in survival Minecraft. Build one and you get a steady stream of gunpowder (for TNT and fireworks), bonemeal from skeletons, and a torrent of XP for your enchanting table — all while you AFK. This guide covers the spawning rules that make it work and a tower design you can build in an afternoon.

spawn floor (dark, 2-high) spawn floor drop chute hopper → chest (gunpowder, XP) Mobs spawn on the dark floors and fall to the centre
Cross-section of a classic dark-room tower: sealed, lit-free spawning floors above a central drop chute that funnels mobs to a hopper-collected kill zone.

How mob spawning works

Before placing a single block, understand the four rules that every mob farm depends on. Get these wrong and you get an empty room.

RuleWhat it means for your farm
DarknessMobs only spawn on solid blocks at light level 0. Seal the farm from sun, moon, and glowstone alike — one lit corner kills that layer.
Player distanceMobs never spawn within a 24-block sphere of you, and despawn beyond roughly 128 blocks. Your AFK spot lives in that 24–128 band.
Solid floor + spaceThe block must be opaque and solid with at least 2 blocks of clear space above it. Carpets, glass, and slabs (on the lower half) do not count as spawnable.
Mob cap sharingThe world has a mob cap. If a cave full of zombies sits under your base, it steals spawns from your farm. Build high up or over an ocean so there is nothing else to spawn nearby.
💡 XP math check A good tower hands you thousands of XP per hour. Plug a target level into our XP Calculator to see how many sessions stand between you and a full set of god gear — then go read the Enchanting Guide on spending it well.
Advertisement

The dark-room tower design

This is the classic "stacked dark rooms" design: several identical spawning floors stacked into the sky. Mobs spawn on each floor, walk onto a center hole lined with open trapdoors (they think it is floor), fall through, and drop onto a campfire that finishes them while leaving the XP orbs for you to collect.

Materials (for a 6-floor tower)

ItemApprox. amountUsed for
Solid blocks (stone, deepslate, any)~6–8 stacksWalls, floors, the shaft
Trapdoors~50Lining each floor's center hole
Water buckets2–4Pushing mobs toward the hole (optional but smoother)
Campfire (no hay block under it)1The kill chamber — 1 dmg/0.5s, mobs die but drop XP
Signs or slabsa fewStopping water/lava from overwriting the campfire
Hopper + chest1 eachCollect the loot automatically
Scaffolding or laddersas neededGetting up to build and to your AFK ledge

Build steps

  1. Pick a build height. Stand on the ground where you will build, then fly or pillar up 100+ blocks. Higher = fewer competing cave spawns.
  2. Make a floor. Lay an 9×9 (or 11×11) solid platform. Leave a 2×2 hole in the exact center.
  3. Wall it in, keep it dark. Build 3-high walls around the edge and put a roof on top. No torches, no windows — light level must be 0 inside.
  4. Trapdoor the hole. Place trapdoors flat over the center hole, then flip them open. Mobs path toward the hole, step on the "floor" that is actually open, and fall.
  5. Stack more floors. Repeat steps 2–4 directly above, separated by 3 blocks. Six floors is a sweet spot for effort vs. rate.
  6. Build the kill chamber. At the bottom of the central shaft, place a hopper feeding a chest, then a campfire on top of the hopper. Mobs drop onto the campfire, die, and drop loot + XP.
  7. Add your AFK ledge. From the chamber, build out 24–128 blocks (or straight up) to a safe spot with a roof. Stand there.
⚠️ The 24-block rule is the #1 mistake If you build the farm and stand inside it to watch, nothing spawns — you are in the no-spawn sphere. Always AFK from the designated ledge, not on the farm itself.

Where to build it

  • Over a deep ocean is ideal: there is no seafloor cave system nearby to steal the mob cap, and the open water guarantees a dark, empty 128-block radius.
  • In the sky over land also works — just go high (100+ blocks). The point is to leave nothing else spawnable within range.
  • Avoid building at ground level near your base or a cave system; you will spend hours watching an empty farm.

What you get & how fast

A 6-floor tower at a good location typically yields 1,000–4,000 XP per hour and a steady pile of:

DropFromUse it for
GunpowderCreepersTNT, fireworks (Elytra boost & crossbow), fire charges
BonesSkeletonsBonemeal for farms and instant crop growth
Rotten fleshZombiesFeed a tamed wolf, or trade to some villagers
Ender pearlsEndermen (if they spawn)Reach the End — pair with our Ender Dragon Guide
XP orbsAll of the aboveMend gear and fuel the enchanting table

Rates at a glance (survival-tested)

A 9×9 spawning floor, built 100+ blocks up over ocean, single-player, optimal AFK spot:

FloorsApprox. mobs / hrApprox. XP / hrGunpowder / hr
2~400–700~800–1,500~40–70
4~900–1,500~1,800–3,000~90–150
6 (guide build)~1,400–2,400~2,800–4,500~140–240
8+~2,000–3,500~4,000–6,000~200–350

XP figures assume you collect the orbs (a hopper-less kill zone) rather than letting them expire. Yields scale with floor count until server or entity limits bite.

AFK setup

To keep the farm running while you step away:

  • Stand on your ledge 24–128 blocks from the farm.
  • Place a bed nearby and set your spawn, in case you get disconnected.
  • If in a zombie-heavy area, keep a shield or a 1×1 safe corner — strays and skeletons can still shoot you from the ground far below, but the open sky usually keeps you clear.
  • Collect XP passively: the orbs fall to the chamber; walk over them (or use a hopper-less design where you stand in the kill zone) to bank levels.

What to do with the loot

The farm is a means, not an end. The two payoffs:

  • Gunpowder → TNT & fireworks. TNT is the fastest way to strip-mine for ancient debris (see our Netherite Guide); fireworks are your Elytra fuel and a lethal crossbow load.
  • XP → enchants. Bank a few levels, then spend them wisely — our Enchanting Guide shows the 15-bookshelf setup and the anvil strategy that avoids "Too Expensive!", and the XP Calculator tells you exactly how much farming each level costs.
💡 Next farm Once gunpowder and XP are covered, an Iron Farm is the natural follow-up — it turns the same AFK time into a renewable supply of one of the game's most-used ingots.

FAQ

Why are no mobs spawning in my mob farm?
Almost always it is one of three things: (1) light is leaking in — every spawnable block must be at light level 0; (2) you are standing in the spawn sphere — move 24+ blocks away horizontally or vertically; (3) the area is full of caves below — build over a deep ocean or at least 100 blocks up so nearby ground does not eat the mob cap.
How far away should I AFK from a mob farm?
Between 24 and 128 blocks (or 24 and 44 for a single-chunk design) from the farm, measured in any direction. Inside 24 blocks mobs do not spawn; beyond ~128 blocks (the despawn radius) spawned mobs instantly vanish, including inside the farm.
Does a simple mob farm work in Java 1.21?
Yes. The dark-room tower design in this guide uses only core spawning mechanics that are unchanged in Java 1.21 — no update, mob, or structure is required for it to function.
How much XP does a mob farm produce?
Roughly 1,000–4,000 XP per hour at a basic tower, scaling with how many spawn layers you stack. That is enough to go from level 0 to 30 several times in a single AFK session — perfect for feeding the enchanting table.
Advertisement

Related guides