monkeytyping

Monkey typing Shakespeare: the infinite monkey theorem

Give a monkey a typewriter and forever, and it types Hamlet. The idea is older and stranger than the meme, and somebody actually tried it.

first stated 1913 Émile Borel, in a paper on statistical mechanics
real monkeys 6 Celebes crested macaques at Paignton Zoo, 2002
pages produced 5 mostly the letter S
lines of Shakespeare 0 in seven weeks of trying

What the theorem actually says

The classical statement is precise: a monkey hitting keys independently and at random on a typewriter keyboard for an infinite amount of time will almost surely type any given text, including the complete works of William Shakespeare. "Almost surely" is a technical term meaning with probability one, and the stronger form says the monkey would type every possible finite text an infinite number of times.

Notice what is doing the work there. It is not the monkey. The picture everyone carries around, a monkey typing on a typewriter, is a rhetorical device for "a source of uniformly random characters": replace it with a dice, a noisy radio, or a random number generator and the theorem is unchanged. The result is really a statement about what happens to small probabilities when you multiply them by infinity.

Where the monkey came from

The image belongs to the French mathematician Émile Borel, who used typing monkeys in a 1913 article on statistical mechanics and again in his 1914 book Le Hasard. He was not making a joke about primates; he was arguing about the difference between events that are merely improbable and events we can treat as impossible in practice.

The version most people half remember comes from the astronomer Arthur Eddington, who wrote in The Nature of the Physical World in 1928 that if an army of monkeys were strumming on typewriters they might write all the books in the British Museum. From there it escaped into general culture and never left.

What happened when someone tried it

In 2002, researchers from the University of Plymouth put a computer keyboard into the enclosure of six Celebes crested macaques at Paignton Zoo in Devon and left it there from the first of May to the twenty-second of June.

The monkeys produced five pages. They consisted largely of the letter S. The lead male started hitting the keyboard with a stone, and the others urinated and defecated on it. No Shakespeare was recovered.

Infinity is carrying the whole argument

The odds for even a short target are brutal. On a 26 letter keyboard the chance of getting a specific 20 character string on a given attempt is one in 26 to the power of 20, a number with 29 digits. For a single Shakespeare play the exponent runs into the tens of thousands. None of that stops the theorem being true, because an infinite number of attempts multiplied by any non-zero probability still gets you there.

What it does mean is that the theorem says nothing useful about the actual universe, which has a finite age and a finite number of particles. A 2024 paper by Woodcock and Falletta in Franklin Open took that seriously and evaluated the problem under finite resources rather than infinite time, which turns a clean mathematical certainty into a much less encouraging arithmetic question.

The opposite of typing skill

There is a neat inversion at the heart of this for anyone who came here to actually measure their typing. The theorem's monkey succeeds through volume and randomness across unimaginable time. A human typist succeeds through precisely the opposite: a small, deliberate, heavily practised set of movements where the same finger goes to the same key every time.

That is not a metaphor, it is what the research shows. Studies of large keystroke datasets find that the strongest predictors of typing speed are consistency of finger to key mapping and the overlap between one keystroke and the next, not effort or force. Randomness is the enemy of a good score. If you want to see how consistent your own keystrokes are, the typing test reports a consistency figure alongside your WPM, and your stats page shows which individual keys break the pattern.

So, no monkeys here

This site is called MonkeyTyping and the name is a nod to the theorem, but the tool is the unromantic version: a real typing test for real typists, measuring deliberate keystrokes rather than random ones. It is independent and unaffiliated with any other typing website. If the theorem is what brought you, the average typing speed page is the human counterpart to all that infinity, and it turns out the typical adult manages about 40 words a minute.

Related reading

Questions people ask

What is the infinite monkey theorem?

It states that a monkey hitting keys independently and at random on a typewriter for an infinite amount of time will almost surely type any given text, including the complete works of Shakespeare. It is a statement about probability over infinite time, not a claim about monkeys.

Did anyone actually test a monkey typing on a typewriter?

Yes. In 2002 researchers from the University of Plymouth put a computer keyboard in the enclosure of six Celebes crested macaques at Paignton Zoo in Devon for about seven weeks. The monkeys produced five pages, consisting largely of the letter S, before the lead male began hitting the keyboard with a stone and the others urinated and defecated on it.

Would a monkey typing randomly ever really produce Hamlet?

With genuinely infinite time and truly random keystrokes, yes, with probability one. In any finite amount of time the odds are so small they are effectively zero. A 2024 paper in Franklin Open examined the theorem under finite resources rather than infinite ones, which is a very different question from the classical statement.

Why is a typing test site writing about this?

Because the site is called monkeytyping.cc and the theorem is where the phrase comes from. The connection ends there: a real typing test measures deliberate, skilled keystrokes, which is close to the opposite of the random ones the theorem assumes. If you came here for the actual test, it is on the home page.