01It's a safe with a computer on top
The first thing to understand is that an ATM is really two machines stacked together, and they don't trust each other much.
The top part is the computer: the screen, the keypad, the card reader, the little camera. That's the part you touch. It looks like a kiosk, and it basically is one, running an ordinary operating system.
The bottom part is a genuine safe. Thick steel, a real lock, bolted to the floor or the building. Inside that safe is the cash and the machine that moves it. The two halves talk to each other, but the money never lives in the part you can reach.
So don't picture a vending machine. Picture a bank vault the size of a mini-fridge with a computer sitting on its head, and a robot arm inside doing the teller's job. Everything interesting happens in that lower box.
A bank vault the size of a mini-fridge, with a computer sitting on its head.
02Where does the money live?
Open the safe and you don't find a loose pile of money. You find cassettes: removable boxes, usually four of them, each holding a single denomination. One box is all twenties, one is all tens, and so on. The bills stand on edge in a tight stack, pressed forward by a spring-loaded plate so the front bill is always ready, like a Pez dispenser for cash.
This is also how the machine knows what it's handing out. It doesn't read the value of each bill it dispenses. It trusts the cassette. The twenties box is loaded with twenties by a technician, labeled as twenties, and the machine counts notes out of it as twenties.
That's why loading an ATM is done under strict procedure. Put the wrong bills in the wrong cassette and the machine will happily hand out the wrong money, because it's counting boxes, not reading faces. When you ask for forty dollars, the computer does the math, decides two notes from the twenties cassette, and sends that order down into the safe.
03How does it grab exactly one bill?
Here's the hardest trick in the whole machine, and it sounds trivial until you try it: pick up exactly one bill. Not two, not a bill and a half. One.
The mechanism uses a pick roller that presses against the front note in the cassette and rolls, dragging that top bill forward by friction. But friction alone would grab the second bill too, because bills cling to each other. So right behind the pick roller sits a second roller, the separator, that spins the other way or holds still, specifically to shove any second bill back into the stack.
One roller pulls the top note out. The other roller says not you to the note behind it. Some machines use gentle suction instead of friction, grabbing just the face of the top bill, but the goal is the same: peel one, hold the rest. That single note gets handed off to a track of belts and rollers that whisk it toward the exit at several bills a second.

One roller pulls the note out. The other says: not you.
04How does it never hand you two bills stuck together?
Peeling one note is the plan. But bills are messy: they stick, they tear, they fold. So the machine doesn't trust its own picker. Every single note, on its way out, passes through a sensor gauntlet.
The key one is the double-detect sensor. As each bill slides by, a sensor measures its thickness, often by shining light through it or measuring how it blocks a beam. A single note has a known thickness and a known translucency. Two stuck together are too thick and too opaque. A torn note is too short or ragged.
The moment a bill reads wrong, the machine doesn't stop and doesn't hand it to you. It diverts that bill into a separate reject bin inside the safe and simply picks another one to replace it. You never see it happen.
This is why the machine can promise you exact cash. It's not counting on the picker being perfect. It's counting every note as it leaves and throwing back anything that fails. The reject bin is the machine's own quality control, and technicians reconcile it later against the records.
05How does an ATM know a bill is real?
The same trip past the sensors is also where the machine can check that a note is genuine, which matters most on the way in, at machines that accept deposits.
Real currency is loaded with features a copier can't fake. There's magnetic ink: parts of a bill are printed with ink that carries a magnetic signature, and a magnetic head reads it like a cassette tape reads music. There are optical tricks visible only under ultraviolet or infrared light: threads that glow, inks that vanish or appear, patterns your eye never sees.
So the note path includes UV and infrared sensors that light the bill up in wavelengths you can't see and check for the right glow, the right dark spots, the right thread in the right place. On a deposit machine, a bill that doesn't pass gets rejected right back out to you before it's ever credited.
That's how a machine with nobody inside can catch a counterfeit. It isn't looking at the bill the way you do. It's reading the invisible layers printed into it, and a fake almost never has all of them.

06Why doesn't the ATM know your PIN?
Now the part most people never think about: not one bill moves until the machine has proven you're allowed to have it, and it does that without ever knowing your PIN.
When you insert your card, the machine reads the chip, a tiny secure computer baked into the plastic that's far harder to clone than the old magnetic stripe. Then you type your PIN, and here's the key: that keypad is not an ordinary keyboard. It's an encrypting PIN pad, a sealed, tamper-protected unit that scrambles your PIN into ciphertext the instant you type it. The ATM's own computer never sees your real PIN. It couldn't hand it over even if it were hacked.
Then the machine phones home. It sends an encrypted message across the banking network to your bank that says, in effect: this card, this account, this scrambled PIN, wants forty dollars, is that a yes? Your bank checks the PIN, checks your balance, checks for fraud, and sends back a single authorization. Only when that yes comes back does the computer up top tell the safe down below: dispense two twenties. The check clears first. The cash moves second. Always in that order.
And every step gets written down. Inside the ATM is an audit journal, a running log of every transaction: card, amount, time, approval, notes dispensed, notes rejected. Nothing about your PIN, but everything about the movement of money. If you say the machine shorted you, or the bank's count doesn't match the cassettes, the journal is the record everyone reconciles against. Combined with the reject bin and the note counts, the money in an ATM is accountable down to the single bill.

The check clears first. The cash moves second. Always in that order.
07What actually goes wrong?
So it's a safe, a robot, and a bank connection. Impressively reliable, but not magic.
Jams. All that peeling and racing of paper is mechanical, and paper fails. A worn note folds, a roller slips, and the track jams. Good machines detect it and retract, but a jam can leave a transaction half-done, which is why banks reconcile the journal against the actual cash.
Retained cards. If a machine loses connection, times out, or suspects trouble mid-transaction, it can pull your card inside and keep it, on purpose, so a card isn't left dangling in a public slot. Annoying, but it's a safety feature.
Skimmers. This is the one to actually care about. Criminals attach a fake card reader over the real slot to copy your card, plus a hidden pinhole camera or a keypad overlay to capture your PIN. So before you insert your card: wiggle the slot and the reader, they should be solid, not loose or bulky. Glance for anything odd above the screen or over the keypad. And cover your hand when you type your PIN, every time. That one habit beats the camera, because the machine encrypts your PIN, so the only place left to steal it is over your shoulder.
And the mundane one: it runs out of cash. The cassettes are finite. On a busy weekend the twenties box empties, and the smartest safe in the world can't hand you what it doesn't have.

08Myth vs mechanism
Myth one: there's cash just sitting loose in there for the taking. There isn't. The money lives in a real steel safe, in labeled cassettes, counted note by note, logged in a journal, and it won't release a single bill until a bank on the other end of an encrypted line says yes.
Myth two: the machine is smart enough to know a real bill by looking at it, like you do. It doesn't look like you do at all. It measures thickness, reads magnetic ink, and checks for glow under light you can't see, then throws back anything that fails. It's not judgment. It's a stack of dumb, ruthless checks that add up to something that feels like judgment.
That's the whole machine. A vault with a computer on its head and a robot inside, that verifies who you are, asks your bank for permission, peels exactly one note at a time, inspects every bill on the way out, and writes down everything it did, all in the few seconds it takes to hand you your forty dollars.
- An ATM is two machines: a kiosk computer on top and a genuine steel safe below, and the money only ever lives in the safe.
- Cash sits in labeled cassettes, one denomination per box. The machine counts boxes; it never reads the value of the bills it dispenses.
- A pick roller peels the front bill while a separator roller shoves the next one back, then a thickness-and-light sensor diverts anything doubled or torn into a reject bin.
- Your PIN is encrypted inside the sealed keypad, and no cash moves until your bank sends back an approval. Check first, cash second.
- An audit journal logs every transaction, so the cash is accountable down to the single bill. The real-world risk isn't the machine, it's skimmers, so cover your PIN.
More how it actually works
Frequently asked
How does an ATM count money?
It doesn't read each bill's value. Cash is loaded into labeled cassettes, one denomination per box, and the machine counts notes out of the right box. A pick roller peels one bill at a time, a separator roller holds the rest back, and a sensor verifies each note by thickness and light as it leaves.
How does an ATM detect fake or stuck-together bills?
Every note passes a sensor gauntlet on its way out. A double-detect sensor measures thickness and translucency to catch two bills stuck together or a torn note, and magnetic, UV, and infrared sensors read security features a copier can't fake. Anything that fails is diverted into a reject bin and replaced.
Does the ATM know my PIN?
No. The keypad is an encrypting PIN pad, a sealed tamper-protected unit that scrambles your PIN the instant you type it. The ATM's own computer only ever handles the encrypted version, and your bank does the actual checking.
Is cash just sitting inside an ATM?
Not loose. It sits in labeled cassettes inside a real steel safe bolted down, counted note by note and logged in an audit journal. The machine won't release a single bill until an encrypted authorization comes back from your bank.