Number Guessing Game

The browser picks a secret number from 1 to 100. Make guesses and use the high-low clues to find it.

0
Enter a number between 1 and 100.
How to play

Use each clue to close in on the secret number.

Start anywhere

Enter a number between 1 and 100.

Read the hint

The game tells you if your guess is too high or too low.

Win efficiently

Try to find the number in as few guesses as possible.

About the game

Number Guessing: Logic and Binary Search

Screenshot of the Number Guess screen showing a guess of 47 and a “too low” hint on SimpleGames.online
Use the high/low hints to home in on the secret number.

Number guessing games are among the earliest examples of computational thinking put into play. The classic "I'm thinking of a number between 1 and 100" game is used in mathematics and computer science education to introduce the concept of binary search — one of the most fundamental algorithms in programming. When applied to this game, binary search is the provably optimal strategy, and understanding it gives you a clear framework for winning efficiently every time.

With perfect binary search strategy, any number from 1 to 100 can be found in at most 7 guesses. You start by guessing 50. If the answer is higher, move to 75. If lower, go to 25. Continuing to halve the remaining range eliminates half the possibilities with each guess — the mathematical process of logarithmic halving. This means the game is not just a fun diversion but a gentle, gamified introduction to one of the most widely used algorithms in software engineering.

Beyond algorithms, number guessing games have been used as probability exercises in classrooms for decades. They teach estimation, rational updating of beliefs given new information, and the value of structured reasoning over random guessing — skills that transfer broadly into everyday decision-making and quantitative thinking.

Tips & strategy

Find any number in 7 guesses or fewer.

Always start at 50

The midpoint of 1–100 halves the search space in a single guess. Whether the answer is higher or lower, you immediately eliminate half the possibilities — the most efficient possible opening move.

Keep guessing the midpoint

After each clue, find the midpoint of the remaining valid range. Told "higher" after 50? Guess 75. Told "lower" after 75? Guess 62. This binary search approach always finds the number in at most 7 guesses.

Track your range mentally

Keep track of your current low and high boundaries. "It is higher than 30 and lower than 70" means the range is 31–69; the midpoint is 50. Writing it down helps until the strategy becomes second nature.

Challenge yourself to fewer guesses

Once you can reliably find numbers in 7 guesses, try for 6 or 5. This pushes you to apply the midpoint strategy more precisely and builds an intuitive feel for logarithmic estimation.

Frequently asked questions

Common questions about the Number Guessing Game.

What is the maximum number of guesses needed?

With a perfect binary search strategy, you can always find a number from 1 to 100 in at most 7 guesses. If you play less optimally, the worst case is higher, but there is no guess limit — you can keep guessing as long as needed to find the answer.

Can I change the number range?

The current version uses the classic 1–100 range. Once you master it, challenge yourself to find numbers in 6 guesses consistently by applying the binary search midpoint method with no written notes.

Is this good for kids learning math?

Yes. The number guessing game teaches estimation, narrowing a range using new information, and basic arithmetic for finding midpoints. It is used in primary school math to introduce reasoning skills and is appropriate for children aged 7 and up.

How is the secret number chosen?

A random integer between 1 and 100 is chosen by the browser at the start of each round using JavaScript's built-in random function. Each number has an equal probability of being selected.

Related games