Fence

Fences are wall blocks that cannot normally be jumped over.

Natural generation
Oak fences spawn naturally:
 * As the uprights for the supports in mineshafts, where they are plentiful.
 * In plains villages and desert villages, where they appear in tables, lamp posts, and even enclosures on roofs or behind buildings.
 * In library rooms of strongholds as railings and chandeliers. In the latter case, there are many torches attached to them.

Spruce fences spawn naturally:
 * In witch huts.
 * In taiga, snowy taiga, and snowy tundra villages, where they appear in tables, lamp posts, and even enclosures on roofs or behind buildings.

Acacia fences generate naturally in savanna villages, where they appear in tables, lamp posts, and even enclosures on roofs or behind buildings.

Oak, birch and dark oak wood fences generate naturally in woodland mansions.

Oak, birch, spruce, jungle, acacia, and dark oak wood fences can generate in shipwrecks.

Nether brick fences can be found naturally in nether fortresses, where they form window bars, balcony fencing, and gate-like structures.

Dark oak fences spawn as the supports in above-ground mineshafts.

Dark oak fences generate in pillager outposts.

Jungle fences generate in desert village armorer houses.

Obtaining
Wood fences are broken most quickly with an axe, but will drop when broken with any tool. Nether brick fences require a pickaxe, mining it with anything else will drop nothing.

Barrier
While fences appear to be a single block tall, and have a hitbox height of one block, their collision box (for entities) is 1.5 blocks tall, meaning most mobs cannot jump over them without the Jump Boost status effect. They are transparent to light and have visual gaps in the model.

A fence occupies the center space of blocks and automatically connects to any solid block that is placed next to it. Wood fences will connect to other wood fences, but will not connect to nether brick fences.

Leads
Fences can be used to attach mobs with a lead.

Fuel
Wooden fences can be used as a fuel in furnaces, smelting 1.5 items per block.

Clicking target
Unlike with most blocks, pressing use on a fence will attempt to play an action. This is an intentionally programmed feature.

Block data
In Bedrock Edition, fences use the following data values:

Trivia

 * If a carpet is placed on top of a fence, a player can jump onto the carpet, while mobs will not (except rabbits).
 * Getting hit by someone else (or shooting yourself with a Punch enchanted bow while sprinting forwards) while in midair can cause the knockback to propel you over a fence you would not be able to jump over normally.