Fence

Fences are wooden wall blocks added in the Seecret Friday update 8. They count as one and a half blocks tall for player/mob collision, and one block tall for all other purposes. They cannot be jumped over from the same level as the fence but can have other blocks placed on top of them. A fence occupies the center space of blocks and automatically connects to one another when another fence is placed next to it. Fences are one of the many blocks that are broken more quickly with a sword, but deals double damage to it.

Standing on top of a fence in multiplayer counts as an illegal move, and has caused players to get stuck. This action has also crashed the server in the past, though this bug was fixed in the Beta 1.3 update.

Despite being made of wood, fences are not flammable (will not disappear due to fire). However, placing fences near lava will result in fire blocks appearing as the lava attempts to burn it.

Uses
A fence's primary use is enclosing an area. Functionally, the fence serves to keep ouside mobs and players out, and inside mobs and players in. A wide area can be made monster-resistant by enclosing it in fences and lighting the inside portion heavily. This keeps any monsters from spawning within the fence, and keeps most monsters which spawned outside the fence from coming in; the exception is spiders, which can climb up or even jump over the fence. In addition, while skeletons are unable to cross a fence, they can shoot over it.

Fences can also be used as railings, especially on the edges of balconies or floating platforms. Since fences cannot be jumped over, this keeps players and mobs from falling off while still allowing them to easily see past the fence.

If a grassy area is fenced in and lit, during the night a large amount of passive mobs will spawn within the fence. This can be used to quickly collect a large amount of drops such as wool or raw porkchops. Additional blocks can be placed along the outside perimeter of the fence, allowing mobs to enter the pasture, but making them unable to leave.

Fence corners do not need to be complete in order to be sealed. A corner where two directions meet at a right angle can be created without the actual corner piece. This will create two separate fences which terminate next to each other without actually touching. While there is a visible gap, players and mobs will still be unable to pass through. This feature can be used to create lengths of diagonal fences, which will appear as nothing but posts, yet will still prevent anything from passing.

If you place a block on top of a fence, the fence reverts to a one block height (i.e., the total height equals 1 (fence) + the new block height).

Since fences count as solid objects, placing a fence on top of dirt will prevent the dirt from growing into grass, even if all other factors needed to grow grass are provided.

Stacking


Multiple fences can be stacked on top of each other by creating a wall of blocks one layer shorter than the intended height of the fence and working down. Removing blocks from underneath the fence doesn't cause it to collapse like cacti and doors, so the lower layers of the wall can one-by-one be replaced by fences easily.This can also easily be done under water with no need for walls or layers below the fence,you can stack fences underwater just like any other block, beginning with one fence post at the very bottom.This allows the players to make thin pillars or chandeliers to seemingly support floating blocks for decoration purposes or to make "streetlights" - two fences stacked with a glowstone block or torches on all sides of a wooden plank on top of it. That may be useful for SMP towns.

Crafting
A formula to calculate the needed amount of wood blocks to make enough fences to surround an area would be W = (3 * (N - U) ) / 8 where W is the amount of wood, N is the number of needed fences (the perimeter for all intents and purposes) and U is the number of fences that you can use for the perimeter. Remember, due to the immense amount of materials, you may have extra fences when dealing with larger amounts of fences.

Glitches


A very rare glitch will occur where the post of the fence will be invisible but can be collected when it's destroyed. Fences placed beyond that point will be invisible for quite some time. This glitch has been observed to occur whenever there is no block in the same chunk (16x16x128) that is above the fence. In some cases, this glitch can be corrected by placing a normal block next to the invisible fence pieces, but removal of the block causes the fence to become invisible again.

This can be rectified by placing a "street lamp" in the part of the fence that is not visible. A guide can be seen here on Youtube

In SMP, running along the top of a fence can cause you to be kicked from the server, with the reason "Flying is not enabled on this server".

Future Plans
There may be plans to add a gate, which would most likely be placed like a fence, and fit aesthetically with other fence pieces. However, it would act like a door, where you would click it to open it. Doors work fine as a substitution, but look out of place between fence posts. This topic is most recognized at this thread on Getsatisfaction.com, where Notch himself commented saying "Hmmm... Possibly! Why not?". That thread was later marked "Under Consideration".

Zaun Płot