Fences are used to keep curious people off your land (and items), or to keep your animals from escaping. A single part of fence requires 6 wooden stakes. Fences can be used as a trap-fence, which blocks the way of most large animals and guides them straight into a trap, usually a trap pit. The player must climb over them, and NPCs and some animals are also capable of climbing fences. All birds can fly over fences, though on rare occasions one can see a landed bird squeeze through the fence as well.

In addition to keeping domestic animals in place, an open pen with a trap and some herbivore oriented bait, such as a planted patch of nettles, can be used to lure a large wild animal in. Once the animal is caught, the pen can be closed off and then the animal can be freed, or escape, from the trap without worry of it running off. Wild "livestock" can be kept in this way as long as the area is regularly visited to prevent the animal from despawning.

While there is some merit to using a body of water to block animals from escaping their pens in order to save time for other work, the decision to leave the pen unfinished is ultimately lazy and foolish. When winter arrives, an unenclosed pen will let livestock animals wander out onto the ice, potentially to their deaths. Even if the water is rapids, a predator can spook animals into the freezing cold water.

In the "Traps" menu (ALT-R) there is the "Build trap-fence" option, that makes the exact same fence as the "Fence" in the "Building options" menu.  Fences can be deconstructed to recover the building materials, and they can also be kicked apart with any attack if you are in a hurry (wooden stakes will be destroyed).

List of land creatures that are known to squeeze through or jump over fences:

Bears are particularly troublesome around fences as they can also knock them over, letting other animals inside or freeing livestock.