Gather materials: 4 sticks and 6 planks (any wood type)
Open the crafting table (or crafting menu)
Place items in the crafting grid:
Top row: planks in slots 1, 2, and 3
Middle row: sticks in slots 2, and planks in slots 1 and 3
Bottom row: planks in slots 1, 2, and 3
Move the resulting fence to your inventory
Place the fence by aiming at a block face and right-clicking (or using the place button)
Add more fences by placing additional fence blocks adjacent to the first one
