How Do Hostile Mobs Spawn in Minecraft?

So I found a village near where I originally spawned and I expanded on it. I thought I could keep it safe by building a 3-4 block high wall around the village, unfortunately this didn't help (now all my villagers are dead!). I still find mobs inside the city walls and inside of the university I built. The university has a basement, and although I usually keep the door to it closed I'll still find the occasional spider, zombie, skeleton warrior or even creepers.

So my question is how do mobs spawn? Does the presence or absence of light make any difference? Are other factors involved?


Yes, the light level makes a difference. In fact, it's probably the single most important factor for hostile mob spawning.

Hostile mobs won't spawn in any area that is above light level 7. Torches produce a light level of 14, and that light level decreases by one for every block (along an axis) out. Therefore, any place that is more than 7 blocks away from a torch could spawn a hostile mob. There are other methods of discouraging hostile mobs from spawning, but keeping a well lit area is key.


Also, try filling your university with the following blocks:

  1. Half-blocks. These are not very convenient, but can work for flooring.
  2. Glass. No mob can spawn on glass.
  3. Liquids. If you have any empty space you cannot enter, wall it up and fill it up with water.

But lighting the areas is probably a better solution. If you add on to the few lights in the village, and light up every little dark space, you can drastically reduce the odds of a monster spawning. You can never be completely sure, however. Sometimes creepers spawn in semi-lit areas and catch you by surprise.