Rail

Rails are non-solid blocks that provide a path along which minecarts can travel.

Obtaining
Rails can be mined with anything, but pickaxes are the quickest.

A rail also drops as an item when the block beneath it is removed, water or lava flows over it, or a piston moves it into a space with no floor below it.

Natural generation
Rails can be found naturally running along the floors of abandoned mineshafts and in woodland mansions.

Usage
A rail can be used as a minecart track and as a redstone component. A sequence of rails (including regular rails, activator rails, detector rails, and powered rails) is called a track.

Placement
To place a rail, a rail item while pointing at a surface facing the space the rail should occupy. A rail can be placed on:
 * the top of any full solid opaque block (stone, dirt, blocks of gold, etc.), including full-block mechanism components (command blocks, dispensers, droppers, note blocks, and redstone lamps)
 * the top of a hopper, upside-down slab, or upside-down stairs.
 * any of the above underwater

A rail cannot be attached to the side or bottom of any block, but attempting to make such an attachment may cause the rail to attach to the top of a block under the destination space. For example, if a fence is on the ground, attempting to attach a rail to the side of the fence causes the rail to be attached to the top of the ground next to the fence instead.

More information regarding placement on transparent blocks can be found at Opacity/Placement.

A placed rail configures itself to be straight or curved according to rail blocks around it.
 * If there are no other rails adjacent, or if placed beside an existing stretch of track of any type, then $$ the new rail orients itself as a straight north-south track, and $$ the new rail orients itself in the direction the player is facing.
 * A new rail placed at the end of an existing stretch of track continues the existing track in the same direction, either east-west or north-south.
 * If there are two adjacent rails on its level, or one level up or down, the newly placed rail configures itself as straight or curved as needed to connect the other two.
 * If placed between three adjacent rails (forming a T-junction) the newly placed rail configures itself as curved to join two of the sides.

Existing sections of track may be re-oriented, become sloping, or even change into curved sections when new rail is placed adjacent to it:
 * An existing straight, north-south rail re-orients to east-west when a new rail is placed at the east or west sides.
 * If placed next to an existing rail that is one block up or down, the new rail slants up or down to join it. Rail "prefers", in order: west, east, south, and north. Other configurations can be created by placing and removing rails.
 * If a track is placed perpendicular to an existing length of track, it appears as a straight rail, but in fact it is curved according to the patterns for tee junctions as seen above; mine carts going through the intersection turn the corner. Breaking and re-laying track so that the intersection block is laid last causes intersection block to be updated as a curved section.

Redstone component
The intersection rail at a T-intersection may be made to change its direction of curvature by applying redstone power using a redstone torch or lever.

Separate tracks laid adjacent but at the next level lower or higher can sometimes cause issues but normally they do not interact with the switched rail.

South-east rule


A minecart travels straight through a T-shaped intersection when entering from the "back of" the curved rail. It follows the curve when entering from either of the other two legs.

A minecart passes straight through a 4-way intersection constructed to have no curved rail. When entering the 4-way from east or west a cart turns according to the south-east rule.

Downhill rule


At non-curve track intersections, minecarts always travel downhill if they can. This is known as the downhill rule and overrides the south-east rule.

Ramp clearance/one-way effect


A block placed above the track at the downhill end of a ramp prevents minecarts from traveling down the slope, but not up. For a minecart to move down a diagonal tunnel, there must be clearance sufficient for a player to walk it.

Curve intersections


If a straight track piece leads to a curve block and isn't attached to the curve, a minecart runs over the gap and continue to go straight over the curve. This is not applicable with other types of rails.

Notably, the minecart can exceed the normal 8 m/s speed limit while it jumps over the gap. For example, by placing intersections on every other block of a straight track, it is possible to travel (uncomfortably) at 10 m/s in a straight direction.

As with straight T-intersections and 4-way intersections, the practice of making a minecart jump tracks can be used to make one-way entries onto a track. On curve intersections the behavior is more intuitive, because the cart simply proceeds in the direction it is already going, allowing designs that don't rely on knowledge of the south-east rule.

Rail performance
A minecart with no rider at full speed can climb 10 blocks on unpowered track. This suggests that a powered track is needed at a height of only 10 blocks to keep a cart climbing. However, the cart slows so much that it can reach only another 5 blocks high with 2 lengths of powered track starting at 9 blocks high. The minimum number of powered rails to keep the cart climbing is 3 every 6 blocks.

Carts with a rider, or minecarts with chest, have more momentum and so climb higher than carts that are unloaded. With a rider, a minecart can climb at least 24 blocks before needing powered rails to go higher. Also, to ascend from 0 to max speed, the player need 7 powered rails.

Block data
In Bedrock Edition, a rail's block data specifies the directions to which it connects.

History
{{History||v1.2.0|snap=?| Texture changed slightly.{{needs testing|were curved rails any different?}} {{History|beta}} {{History||1.6|snap=?|Before this update, parallel tracks would be used to create minecart boosters.}} {{History||1.8|snap=Pre-release|Rails are found in the new abandoned mineshaft chests.}} {{History|java}} {{History||1.0.0|snap=Beta 1.9 Prerelease|Rails are destroyed by snowfall (bug).}} {{History|||snap=Beta 1.9 Prerelease 4|Some rail behavior was affected following changing the south-west rule to south-east rule.}} {{History||1.3.1|snap=12w25a|Rails can now be placed on upside-down slabs and stairs.}} {{History||1.5|snap=13w04a|Mobs no longer walk over rails if they are not currently standing on one.}} {{History||1.9|snap=15w44a|Increased average yield from mineshaft chests by more than 20 times. Mobs no longer spawn on rails.}} {{History||1.11|snap=16w32b|All rail types' hitbox heights are decreased from a full block to a half block.}} {{History|||snap=16w39a|Rails now generate in woodland mansions.}} {{History||1.13|snap=17w47a|Prior to The Flattening, this block's numeral ID was 66.}} {{History||1.14|snap=18w43a| Changed rail textures.}} {{History|java upcoming}} {{History||1.15|snap=19w39a|Placing a new, unconnected section of rails now orients them in the direction the player is facing, rather than always north-south.}} {{History|pocket alpha}} {{History||0.8.0|snap=build 2|Added rails.}} {{History||0.9.0|snap=build 1|Rails now naturally spawn in abandoned mineshafts.}} {{History||0.14.0|snap=build 1|rail now found in mineshaft chest }} {{History|pocket}} {{History||1.1.0|snap=alpha 1.1.0.0|Rails now generate in woodland mansions.}} {{History|bedrock}} {{History||1.4.0|snap=beta 1.2.20.1|Rails can now be placed underwater.}} {{History|console}} {{History||xbox=TU1|xbone=CU1|ps=1.0|wiiu=Patch 1|Added rails.}} {{History|new 3ds}} {{History||0.1.0|Added Rails.}} {{History|foot}}

Trivia

 * When walking on a block that has a rail on top, the player hear the sound of the block they are walking on, but if they jump (while still walking), they hear the sound of iron.
 * Rails are 750 mm (approx. 2-foot 5-inch) narrow gauge. (The gauge is the distance between the rails.)