Interactive · Simulation
The Lab: a Virtual Skinner Box
A hungry, untrained rat, a lever, a food tray, and you holding the pellet button. Magazine-train it, shape a lever press one approximation at a time, put the press on a schedule of reinforcement, then take the food away and watch extinction. About three minutes, no account, works on a phone.
In brief
- The lab is a stylized model of an operant conditioning chamber: the rat's tendencies shift with what you reinforce, drift back when you don't, and follow the schedule patterns Ferster and Skinner documented. It is not a replay of real data.
- You will do the four things every operant experiment does: establish the reinforcer (magazine training), shape a new response, thin reinforcement onto a schedule, and run extinction.
- The counters under the chamber are a cumulative record in miniature: every pellet you deliver and every press the rat makes, from the first step on.
- Magazine trainingTeach the rat what the click means.
- ShapingReinforce successive approximations of a lever press.
- SchedulesCompare CRF, ratio, and interval schedules.
- ExtinctionStop reinforcing; watch the burst, then recovery.
The rat is a stylized model — its tendencies shift with what you reinforce, drift back when you don't, and follow the schedule patterns Ferster and Skinner documented — not a replay of real data. Real shaping takes longer and real rats are more surprising.
How to run the lab
The lab walks you through the same sequence a first-year student runs with a live rat, compressed from a week into a few minutes. Each step is a real procedure with a real name.
- Magazine training. Before the rat can learn that pressing produces food, it has to learn that the click of the food magazine means food. Deliver a few free pellets. The click becomes a conditioned reinforcer, which is what lets you reinforce a movement the instant it happens instead of waiting for the rat to find the tray.[1]
- Shaping. Now reinforce successive approximations: facing the lever, approaching it, rising toward it, touching it, pressing it. Each time the rat reliably produces the current step, stop paying for that step and pay only for the next one. Reinforce too early and you get a rat that stands still; too late and the behavior you were building drifts away. This is shaping by successive approximations, and it is the single most useful skill on this site.[2]
- Put the press on a schedule. Once the rat presses on its own, move from continuous reinforcement to an intermittent schedule — a fixed ratio, a variable ratio, a fixed interval, a variable interval. Watch the rate and the pattern change: the pause after each reinforcer on a fixed ratio, the steady grind of a variable ratio, the scallop of a fixed interval.[3]
- Run extinction. Stop delivering pellets and watch. Rate usually rises first — the extinction burst — then falls, and if you come back later it partly returns (spontaneous recovery). A rat trained on a variable ratio takes far longer to give up than one trained on continuous reinforcement, which is the partial reinforcement extinction effect.[3][4]
What to watch for
The point of a Skinner box was never the box; it was the rate of response as a dependent variable, and the way that rate changes moment to moment under different contingencies. A few things worth noticing while you run it:
- Timing. A pellet delivered one second late reinforces whatever the rat was doing one second later. If your rat starts doing something odd, look at what you reinforced, not at the rat.[2]
- Criterion drift. In shaping, the criterion has to move. If you keep paying for "approach the lever," you get a rat that approaches the lever forever.
- Rate versus pattern. Two schedules can produce similar average rates with very different patterns. Ratio schedules produce pausing after reinforcement and fast runs; interval schedules produce steadier, lower rates. The counters show rate; the animation shows the pattern.[3]
- Extinction is not forgetting. When the presses stop, the learning has not been erased. Come back and the response recovers on its own for a while, and it returns almost instantly if a single pellet is delivered.[4]
Where the real thing differs
Real rats take days, not minutes: magazine training is typically a session on its own, and shaping a clean lever press can take an hour of careful work by an experienced trainer. Real rats also bring their own repertoire — sniffing, grooming, rearing — that a model rat does not, and that repertoire is exactly what makes shaping an art. Skinner's own account of discovering shaping, with a pigeon and a wooden ball, is a good reminder that the method was found by doing it.[2][5]
For teachers and students
The lab is free to assign and link. It runs in any modern browser, on phones, without an account, and nothing a student does is tracked. Suggested uses:
- Before the lecture on shaping. Ask students to shape a lever press and write down each criterion they used. Compare lists: the number of steps, where people got stuck, and what happened when a criterion was raised too fast.
- Schedules lab. Have each student run the same rat on two schedules and describe the difference in pattern in their own words before they learn the terms. Then match their descriptions to the four idealized cumulative records.
- Extinction and persistence. Train one rat on continuous reinforcement and one on a variable ratio, extinguish both, and count presses to extinction. This is the partial reinforcement extinction effect, done by hand.
Citation formats and learning objectives for the whole site are on the teachers page. If you want the apparatus itself explained part by part — the lever, the magazine, the cumulative recorder — read The Skinner box.
Key takeaways
- Magazine training makes the feeder click a conditioned reinforcer, which is what makes precise shaping possible.
- Shaping is differential reinforcement of successive approximations with a moving criterion: pay for the current step until it is reliable, then only for the next one.
- Schedules change the pattern of behavior, not just its amount: ratio schedules produce pauses and runs, interval schedules produce steadier rates and scallops.
- Extinction produces a burst, then decline, then partial spontaneous recovery, and behavior trained on intermittent reinforcement is far more persistent.
- The model is stylized. Real rats are slower, more varied, and more surprising, which is why shaping them is a skill.
Check yourself
Your rat rears up near the lever and you deliver a pellet a full second later, just as it drops back down and turns away. What did you reinforce?
Whatever was happening when the pellet arrived: dropping down and turning away. Reinforcement acts on the behavior it follows immediately, not on the behavior you intended. Shorten your reaction time, or use the magazine click as a marker.
After shaping, you switch the rat to a fixed-ratio 10 and notice it stops for a moment after every pellet before pressing quickly again. Is something wrong?
No. That is the post-reinforcement pause characteristic of fixed-ratio schedules, followed by a high-rate run. It is the signature of the schedule, not a fault in training.
Want more? The 20-question quiz covers every page on the site with instant explanations.
Frequently asked questions
Is the virtual Skinner box based on real data?
No. It is a stylized model. The rat's tendencies shift with what you reinforce, drift when you stop, and follow the schedule patterns described by Ferster and Skinner, but it is not a replay of recorded sessions. Real shaping takes longer and real rats vary more.
Is it free, and can I assign it to a class?
Yes. There is no account, no paywall, and no tracking. Link to https://operantconditioning.com/lab/ directly; citation formats are on the teachers page.
What is a Skinner box?
An operant conditioning chamber: a small enclosure with a lever or key, a device that delivers reinforcers such as food, and a recorder that counts responses. Skinner built it to measure how consequences change the rate of a freely emitted behavior. The full explanation is on the Skinner box page.
What is magazine training?
The first step of any operant experiment: delivering free reinforcers so the animal learns that the sound of the food magazine predicts food. The click becomes a conditioned reinforcer that can then mark the exact moment a response occurs.
Why does the rat press faster when the food stops?
That is the extinction burst: a temporary increase in the rate, force, or variability of a behavior when its reinforcer is first withheld. It is followed by a decline, and later by some spontaneous recovery.
Does the lab work on a phone?
Yes. It is a small JavaScript simulation that runs in any modern browser, including iOS Safari and Android Chrome.
References
- Skinner, B. F. (1938). The Behavior of Organisms: An Experimental Analysis. Appleton-Century.
- Peterson, G. B. (2004). A day of great illumination: B. F. Skinner's discovery of shaping. Journal of the Experimental Analysis of Behavior, 82(3), 317–328.
- Ferster, C. B., & Skinner, B. F. (1957). Schedules of Reinforcement. Appleton-Century-Crofts.
- Skinner, B. F. (1953). Science and Human Behavior. Macmillan.
- Skinner, B. F. (1956). A case history in scientific method. American Psychologist, 11(5), 221–233.