← All articles
technologylockssecuritymechanismsSeptember 17, 20264 min read

How Does a Lock and Key Work? Lifting Obstacles to Exactly the Right Height

By the BrainSnail editorial team. How these articles are written and checked, and how to tell us when one is wrong.

A lock holds a bolt in place with obstructions that block a rotating plug. The correct key lifts every obstruction to precisely the height that clears the boundary between the moving and fixed parts, and any other key leaves at least one either too low or too high. Everything about lock design and lockpicking follows from that one arrangement.

The pin tumbler mechanism

The dominant design worldwide is the pin tumbler, patented in its modern form by Linus Yale junior in 1861 and descended from an Egyptian principle thousands of years old. A cylindrical plug sits inside a fixed housing, and a row of holes drilled through both contains stacks of two pins: a key pin resting on the key and a driver pin above it, pushed down by a spring. With no key inserted, the driver pins span the gap between plug and housing, physically preventing rotation. The correct key raises each stack by exactly the amount that places the join between the two pins level with the shear line, the boundary where plug meets housing, so nothing crosses it and the plug turns. Each pin position is cut to a different depth on the key, and the number of pins and depths available determines how many different keys exist, which is why a lock with five pins and six depths has several thousand possible combinations rather than a large number.

Why they can be picked

The vulnerability is manufacturing tolerance, and it is inherent rather than a defect:

  • The holes are not drilled in perfect alignment, so applying slight rotational force binds one pin before the others
  • A picker applies light turning pressure with a tension wrench and pushes pins individually, and when a binding pin reaches the shear line the plug rotates a fraction and catches it there
  • That creates a small ledge, so the pin stays set, and the next pin then binds, allowing the lock to be picked one pin at a time rather than requiring all simultaneously
  • Raking scrubs a serrated pick across all pins rapidly under tension, which sets several by chance and works surprisingly often on cheap locks
  • Bump keys, cut to maximum depth at every position, transfer an impact to the key pins so the driver pins jump momentarily above the shear line, which defeats a great many domestic locks in seconds
  • Security pins with spool or mushroom shapes are designed to give false feedback and resist that process, and high security locks add sidebars, sliders, magnets and tighter tolerances

The other designs

Several mechanisms solve the same problem differently. Wafer locks use flat wafers instead of pin stacks and are cheaper, weaker and common in furniture and vehicles. Disc detainer locks rotate a stack of discs to align slots for a sidebar, which resists picking well and is used in high security padlocks. Lever locks, standard on older British doors, use pivoting levers that must each be lifted to the correct height to clear a stump on the bolt, and are specified by the number of levers, with five required by British insurance standards. Warded locks, the oldest form, simply block a key of the wrong shape with fixed obstructions, offering essentially no security and surviving on cabinets and as the origin of the classic skeleton key. Combination locks dispense with a key by aligning notched wheels through a dial. Electronic locks replace the mechanical decision entirely with a credential check, which moves the attack surface to the electronics and the network rather than removing it.

What security actually means here

Lock security is properly understood as delay rather than prevention, since anything can be defeated given enough time, tools and lack of interruption, and standards reflect that by rating locks for how long they resist specified attacks. The realistic threat model matters more than the mechanism, because most break-ins do not involve picking at all: forcing the door or frame, breaking glass, attacking the cylinder by snapping or drilling, or simply finding an unlocked entrance are all faster and require no skill. Cylinder snapping in particular became a widespread method against certain common lock designs and prompted new standards specifically testing resistance to it. The locksmithing community has a long-running argument about disclosure, with the traditional position favouring secrecy about vulnerabilities and the position articulated in the nineteenth century by Alfred Hobbs, who publicly picked locks advertised as unpickable, holding that exposing weakness is the only way to get it fixed, which is the same argument that recurs in computer security a century and a half later.

The takeaway

A pin tumbler lock blocks rotation with stacked pins spanning the boundary between plug and housing, and the right key lifts each stack so the join between its two pins sits exactly at that boundary. Manufacturing tolerances mean pins bind one at a time under turning pressure, which is what makes picking possible, and bump keys defeat many domestic locks in seconds. Lever, disc detainer and wafer designs solve the same problem differently, and security means delay rather than prevention.

Practise this

Questions from Cybersecurity

Reading about something is not the same as being able to recall it. These are real questions from the Cybersecurity unit in our Technology track, answers and explanations included. The unit has 114 in total across 22 steps.

  • Put in orderLevel 3

    1. Order these steps a firewall follows when a connection arrives.

    Answer: A connection tries to reach the network -> The firewall checks it against its rules -> The firewall allows or blocks the connection

    A firewall checks the traffic, compares it to its rules, then allows or blocks it.

  • Multiple choiceLevel 2

    2. If a stranger emails you a link you did not expect, what is the safest choice?

    • Do not click itcorrect
    • Click it right away
    • Forward it to all your friends
    • Type your password into it

    Unknown links can be dangerous, so it is safest not to click them.

  • Multiple choiceLevel 1

    3. What does encryption do to information?

    • Scrambles it so only the right key can read itcorrect
    • Makes it print faster
    • Turns it into a picture
    • Deletes it forever

    Encryption scrambles information so only someone with the right key can read it.