How does a lock and key work?
Overview
Short answer
A pin tumbler lock is blocked by spring-loaded pairs of pins that cross the gap between the turning plug and the fixed housing. The right key lifts every pin pair by exactly the right amount, so all the gaps line up at that shear line and the plug can turn.
Most front doors use a pin tumbler lock, a design patented by Linus Yale Jr. in the 1860s from an idea that goes back to ancient Egypt. Its secret is a row of tiny spring-loaded pins that only line up perfectly for one shape of key. Try cutting your own key in the figure: click each column to change that cut.
Play with the figure, then press Next (or the → key) to go step by step.
A cylinder inside a cylinder
The lock has a fixed outer housing and an inner plug that turns to work the latch. The keyhole is in the plug. The thin gap between plug and housing is called the shear line: if nothing crosses it, the plug can turn.
Pins block the shear line
Drilled through both parts are five or six holes, each holding a stack of pins: a key pin at the bottom, a driver pin on top and a small spring pushing them down. With no key, the driver pins sit half in the plug and half in the housing, bridging the shear line and jamming the plug in place.
The right key lines them all up
Every key pin is a different length. The key's jagged edge, its bitting, lifts each stack by exactly the right amount so that the gap between the key pin and the driver pin sits precisely on the shear line. Only when every stack is aligned at once can the plug turn. One cut too high or too low and a pin still blocks it.
How many different keys are there?
With 5 pins and, say, 5 possible depths each, there are 5 × 5 × 5 × 5 × 5 = 3,125 combinations. Real locks use 6 pins and up to 10 depths, giving up to a million in theory, though manufacturing rules (neighbouring cuts can't differ too much) reduce that.
How locks are picked
No lock is machined perfectly, so the pin holes are never in a perfectly straight line. A lock picker applies gentle turning pressure with a tension tool, which makes one pin bind first. Lifting it until it clicks at the shear line lets the plug rotate a hair, and then the next pin binds. Higher-security locks add security pins shaped like spools or mushrooms that give false clicks, and other mechanisms such as sidebars.
Common myths
- "Every key is unique." Many locks share the same bitting, which is why keyed-alike and master-key systems are possible.
- "More pins means unpickable." More pins slow a picker down, but the quality of the machining and security pins matter more.
- "Smart locks replace all this." Many smart locks still contain a pin tumbler cylinder as a backup.
Questions people ask
How does a master key work?
Some pin stacks get an extra small pin, creating two different gaps that can sit on the shear line. One gap matches each individual key; the other matches the master key.
Why does my key sometimes stick?
Worn keys or dirt in the cylinder stop the pins lining up exactly. A dry graphite or PTFE lubricant usually helps; avoid oily sprays that attract dust.
What is a deadbolt?
A bolt that is moved only by the key or thumb-turn, not by a spring, so it cannot be pushed back by sliding a card into the gap.
Can a key be copied from a photo?
Yes. The bitting can be read from a clear photo, so don’t post pictures of your house keys.
What is lock bumping?
Tapping a specially cut “bump key” jolts all the driver pins upward at once, so for an instant the shear line is clear. Anti-bump locks use security pins to resist it.
Test yourself
Pick an answer for each question. Every answer comes with an explanation.
0/4 answered01What stops the plug turning when there is no key?
02What does the right key do?
03How many combinations do 5 pins with 5 depths give?
04Why can locks be picked one pin at a time?
Sources & more
Sources
- Pin tumbler lock (Wikipedia)(opens in a new tab)
- Lock picking (Wikipedia)(opens in a new tab)
- Master keying (Wikipedia)(opens in a new tab)
- Linus Yale Jr. (Wikipedia)(opens in a new tab)
Last updated 2026-11-26
Keep exploring
- Everyday ObjectsExplore it
How does a zip work?
- Everyday ObjectsExplore it
How does a ballpoint pen work?
- Everyday ObjectsExplore it
How does a vacuum flask work?
- Home AppliancesExplore it
How does a refrigerator work?
- Home AppliancesExplore it
How does a microwave oven work?
- Phones & GadgetsExplore it
How does noise cancelling work?