Infinite Monkey Theorem: Can Monkeys Type Shakespeare?

Quick answer: The infinite monkey theorem states that a monkey pressing keys independently and at random forever will, with probability 1, eventually type any specified finite text, including the complete works of Shakespeare. If each attempt succeeds with probability p, the chance of success within n independent attempts is 1 − (1 − p)^n, which approaches 1 as n grows without limit. But infinity is essential: a 2024 study by Stephen Woodcock and Jay Falletta calculated that producing Shakespeare at random within a finite universe is overwhelmingly unlikely.

Facts checked November 22, 2026.

Give a monkey a typewriter and infinite time, and it will eventually type Hamlet. This famous claim, popularized by French mathematician Émile Borel in 1913, is mathematically true. It is also wildly misleading about our real universe. The gap between the two answers is a lesson in probability, exponents and the strange power of infinity.

Step 1: The Chance of One Short Word

Suppose a keyboard has 30 keys (letters plus some punctuation) and each key is equally likely. The chance that 7 random keystrokes spell “bananas” is

\[ p = \left(\frac{1}{30}\right)^{7} = \frac{1}{30^7} = \frac{1}{21{,}870{,}000{,}000}, \]

about 1 in 22 billion, for one particular block of seven keystrokes. Each extra letter multiplies the difficulty by 30. Probabilities of independent events multiply (see how to calculate probability).

Step 2: Why Infinity Guarantees Success

Split an endless stream of random typing into separate, non-overlapping blocks of 7 keystrokes. Each block independently spells “bananas” with probability \(p\). (Overlapping positions in a continuous stream are not independent, which is why we use separate blocks to keep the math exact.) The chance that none of \(n\) blocks succeeds is

\[ (1 – p)^n. \]

No matter how tiny \(p\) is, as long as it is greater than 0, \((1-p)^n\) shrinks toward 0 as \(n\) grows without bound. So with infinite time, success has probability 1: mathematicians say it happens almost surely. The same argument works for any finite text, including all of Shakespeare.

Step 3: Why Our Universe Is Not Enough

In 2024, mathematicians Stephen Woodcock and Jay Falletta of the University of Technology Sydney published “A numerical evaluation of the Finite Monkeys Theorem” in Franklin Open. Their assumptions:

  • A 30-key keyboard and one keystroke per second.
  • A chimpanzee’s working life of \(10^9\) seconds, just over 30 years.
  • About 200,000 chimpanzees, the current population, typing until an assumed heat-death timescale of \(10^{100}\) years (a modeling assumption, not a known end date).

That allows about \(6.4 \times 10^{103}\) chimpanzee working lives. Their conclusion: short words are possible, but long texts are effectively impossible.

Check the Numbers Yourself

“Bananas” in one chimp’s lifetime. Expected keystrokes needed: about \(30^7 \approx 2.2 \times 10^{10}\). In a lifetime of \(10^9\) keystrokes, the chance of success is about

\[ 1 – e^{-10^9 / (2.2 \times 10^{10})} \approx 1 – e^{-0.046} \approx 4.5\%, \]

about 4.47%, the roughly 5% figure reported in coverage of the study.

A whole play. Assume Hamlet has roughly 130,000 characters (an estimate). The expected number of keystrokes is about \(30^{130{,}000}\). Since \(\log_{10} 30 \approx 1.477\),

\[ 30^{130{,}000} \approx 10^{130{,}000 \times 1.477} \approx 10^{192{,}000}. \]

All the chimps until the assumed end of the universe type only about \(6.4 \times 10^{103} \times 10^9 = 6.4 \times 10^{112}\) keystrokes, roughly \(10^{113}\). That is not even close: \(10^{113}\) is smaller than \(10^{192{,}000}\) by a factor with almost 192,000 digits. For comparison, the observable universe has only about \(10^{80}\) atoms. Work with numbers this size using exponents and logarithms.

Finite vs Infinite at a Glance

TargetInfinite timeOur universe (all chimps, until heat death)
“bananas”CertainVery likely; about 5% for a single chimp in one lifetime
A full sentenceCertainExtremely unlikely
Complete works of Shakespeare (about 884,647 words)CertainEffectively impossible

The 2024 study did not disprove the infinite monkey theorem. It showed why an infinite-time result cannot be treated as a realistic prediction: a finite number of random characters, however astronomically large, gives no guarantee of producing a particular long text. The authors compare this to other paradoxes, such as the St. Petersburg paradox, where infinite-resource answers clash with finite reality.

A Real Experiment

In 2003, a project left a computer keyboard in an enclosure of macaques at Paignton Zoo in England. Over about a month the monkeys produced roughly five pages, mostly the letter “S,” and damaged the keyboard. Real monkeys are not mathematical monkeys: their keystrokes are neither independent nor uniformly random.

What About AI?

A language model is the opposite of a random monkey: instead of giving every key equal probability, it gives most of its probability to sensible next words (see information theory explained). That is why a chatbot can write a sonnet in seconds while random typing could not do it in the lifetime of the universe. Structure, not luck, produces meaningful text.

Common Misconceptions

“Given enough time, anything will happen.” Only in an idealized infinite setting. In finite time, astronomically unlikely events effectively never happen.

“Almost surely means certainly.” In probability, “almost surely” means probability 1, which in infinite settings is not quite the same as logically certain.

“The theorem is about monkeys.” The monkey is a stand-in for any random process; the math is about independent trials.

Watch: The Infinite Monkey Theorem

If you learn better by watching, these videos are worth your time.

Study Finds Typing Monkeys Will Never Produce Shakespeare After All (Anton Petrov). A clear walkthrough of the 2024 Finite Monkeys study.
That Time Someone Actually Tested the Infinite Monkey Theorem And Who Came Up With It (Today I Found Out). The history of the idea and the real zoo experiment.

Check Your Understanding

Five quick questions to see how much of this has stuck. Pick an answer and press Submit; you will see a short explanation either way.

Answer each question and press Submit to see your result right away.

1. With a 30-key keyboard, what is the chance 3 random keys spell “cat”?
Found a bug? Let us know!
2. Why does infinite time guarantee success?
Found a bug? Let us know!
3. About what chance does one chimp have of typing “bananas” in its working life?
Found a bug? Let us know!
4. If log₁₀ 30 ≈ 1.477, about how big is 30^130,000?
Found a bug? Let us know!
5. What did the 2024 Woodcock and Falletta study conclude?
Found a bug? Let us know!

Frequently Asked Questions

What is the infinite monkey theorem?

The statement that a random typist given infinite time will almost surely type any given finite text, such as the complete works of Shakespeare, because the probability of never doing so shrinks to zero.

Could monkeys really type Shakespeare?

Not in our universe. A 2024 study found that even 200,000 chimpanzees typing one key per second until the heat death of the universe would almost certainly never produce Shakespeare’s works.

What is the probability of a monkey typing a word?

For a 30-key keyboard, a specific 7-letter word like “bananas” has probability (1/30)^7, about 1 in 22 billion per attempt. A single chimp typing for about 30 years has roughly a 5% chance.

Why does infinity change the answer?

With n independent tries, the chance of never succeeding is (1 − p)^n. For any p above zero, this goes to 0 as n becomes infinite, so success becomes almost sure.

Does the infinite monkey theorem mean everything imaginable must happen?

No. It applies to specified finite sequences under suitable random-typing assumptions. Something with zero chance per attempt does not become possible just because time is infinite.

Who came up with the infinite monkey theorem?

French mathematician Émile Borel popularized the image of typing monkeys in 1913; the idea has older roots in philosophy.

Keep Exploring

Sources and Further Reading

Related to This Article

What people say about "Infinite Monkey Theorem: Can Monkeys Type Shakespeare? - Effortless Math"?

No one replied yet.

Leave a Reply