MineToolsminetools.cn · Minecraft Java Tools

Rail command

minecraft:railEnglish name Rail

Rail (minecraft:rail) can be stacked up to 64.Here are common commands for giving, placing, clearing, and checking. Click "Copy" to use one.

Common Commands

Give the nearest player 1 Rail
/give @p minecraft:rail
Give a stack (64)
/give @p minecraft:rail 64
Give all players
/give @a minecraft:rail
Gold Name
/give @p rail[custom_name={translate:"block.minecraft.rail",color:"gold",italic:false}]

To use a name of your own, replace the translate part with plain text

Place one at your feet
/setblock ~ ~ ~ minecraft:rail
Fill a 5×5 Area
/fill ~-2 ~-1 ~-2 ~2 ~-1 ~2 minecraft:rail

Replaces the block layer beneath you

Clear all Rail from the player
/clear @p minecraft:rail
Check if holding Rail
/execute as @a if items entity @s weapon.mainhand minecraft:rail run title @s actionbar ["",{text:"✔ ",color:"green"},{translate:"block.minecraft.rail"}]
Edit in the Item Generator (name, enchantments, attributes, ...)

Basic Information

Item ID
minecraft:rail
Max Stack Size
64
Type
Block (placeable)

Data from the official Minecraft Java 26.3 data. All commands have passed the 26.3 syntax check.