The odds that random typing hits a target string
This works out the chance that a monkey hammering a keyboard at random types one particular string. Enter the target length, the number of distinct characters and how many attempts, and three figures come back together.
The formulas used
With M distinct characters and a target of length L, the chance of an exact match in one try is q = (1 / M)L, the chance of at least one match in n tries is 1 - (1 - q)n, and the expected number of attempts is ML. All three leave double-precision range quickly, so everything is computed with base-10 logarithms and printed in scientific notation; when q falls below 10 to the power of -300 the tool switches to the first-order approximation n x q and says so on screen.
Assumptions and what is out of scope
Every keystroke is assumed independent and all M characters equally likely. Real letter frequencies and keyboard layouts are not modelled. The character count M is your input: it depends on whether spaces, letter case and punctuation are counted, so no value such as 26 is baked in. Character counts for writing systems other than the English alphabet are not confirmed by an official source here. The tool also counts one attempt of length L at a time and does not handle overlapping occurrences of the target inside a longer stream of text. Educational reference material as of October 2026.
Frequently asked questions
26 is the count for lowercase English letters only. Adding a space makes 27, distinguishing uppercase makes 52, and adding punctuation makes it larger still. Which character set applies is your decision, so no value is fixed.
As the number of attempts grows, 1 - (1 - q)^n approaches 1, so the probability converges to 1. That is a limit as attempts go to infinity; for any finite number of attempts the value is the very small number this tool reports.
Even a slightly longer string pushes the probability outside the range a double-precision number can hold. Every step is therefore computed in logarithms and reported in scientific notation.