A dungeon (or donjon) is an underground prison or vault, typically built underneath a castle. Although many real-life dungeons are simply a single plain room with a heavy door, the use of dungeons for torture, along with their association to common human fears of being trapped underground, have made dungeons a powerful metaphor in a variety of contexts.

See also oubliette.

In games, dungeons represent a dangerous area with many hidden secrets to explore. For instance, in role-playing games like Dungeons & Dragons, castles will have dungeons with dozens of levels going hundreds of meters down, with deeper levels having progressively greater dangers and rewards. This metaphor has become so common that games built around this design are known (somewhat pejoratively) as dungeon crawls. The confined and constrained nature of the dungeon also simplifies the programming of computer role-playing games.