Locking something
Right-click an unlocked chest, barrel, door or trapdoor with a Key to lock it. Every Key gets its own random 5-digit code the first time it’s in your inventory, and the lock takes on that code. You’ll see a message with the code when it locks. Locking a double chest locks both halves.
From then on, only a Key with the same code opens it. The Key works from your hand or from anywhere in your inventory, so you don’t need to hold it.
- Hold Shift while hovering over a Key to see its code.
- Anyone without the right Key gets a “is Locked!” message and can’t open it.
- Other players can’t break your locked container. You, as the one who locked it, can always break it, and so can anyone carrying the right Key.
- A locked door or trapdoor ignores redstone, villagers, zombies, pistons and wind charges. Only someone with the Key can open it.
Copying a Key
Put the Key in the left slot of an anvil and an Iron Ingot in the right slot. You get a copy with the same code and keep the original, so you can hand copies to friends.
Wearing a Key
With Curios installed on NeoForge, you can wear a Key in its own key slot, and it opens matching locks without taking up inventory space. This isn’t available on Fabric yet.
A Key doesn’t stack, so each one keeps its own code.



