A fence is a barrier block that is similar to a wall. Fences are typically one of the first things you will need to craft when beginning your journey in a new world. In general, fences provide extreme utility in farming in the game and feature in most farm builds, both big and small.
Fences are important functional and decorative items in Minecraft. Use fences around a house for decoration or use a fence to contain your horses, sheep, pigs or other animals.
Fences spawn naturally in many of the biomes in which their wood type is found. Fences also spawn on shipwrecks and at woodland mansions. Additionally, many types of stone and bricks in Minecraft can be made into walls and perform the same useful or decorative function as a fence.
The game features 8 different styles of fences. The materials required in order to craft a fence are 4 wood planks (any type) and 2 sticks.
Fence Gates: Fence gates can be opened and closed by clicking on the gate with the mouse or the use button on other editions. Each type of Wood Fence has a corresponding Fence Gate.
Checkout How to make a fence in Minecraft for an in-detail explanation.