Number Guessing Game (Bulls and Cows)

Bulls and cows are your only clues. Choose 3, 4 or 5 digits.

Fewest guessesNo record

The digits never repeat, and the first digit can be 0

Type a 3-digit number and submit it

Type with the number keys · Enter to submit · Backspace to delete a digit

What this number guessing game is

The computer picks a secret number whose digits are all different, and you work it out from the feedback on each guess. It's the digit version of an old pencil-and-paper game usually called bulls and cows. According to Wikipedia's article on bulls and cows (checked September 2026), it was played with paper long before it was boxed, and it was the direct inspiration for Mastermind, the 1970 board game by Mordecai Meirowitz that scores the same way using coloured pegs instead of digits. In Korea and Japan the same game goes by baseball terms — strikes and balls.

Each guess comes back with three possible signals:

  • Bull — right digit in the right position
  • Cow — right digit in the wrong position
  • OUT — none of your digits appear in the answer at all

If the answer is 472 and you guess 427, the 4 is in place (1 bull) while 2 and 7 are present but misplaced (2 cows), so you get 1 bull, 2 cows.

The rules here

  • Choose three, four or five digits.
  • Every digit in the answer is different — no repeats, ever.
  • Zero can lead. 047 is a perfectly valid three-digit answer, so don't rule it out early.
  • Repeating a digit in your guess, or submitting an incomplete one, gets flagged on the spot and doesn't cost you a turn.
  • Type with the on-screen keypad or, on a computer, the number keys. Enter submits, Backspace deletes.
  • Every guess is added to the history table — number, guess, bulls and cows — which doubles as your scratch paper.
  • There is no solver and no hint button. Working it out is the game. If you're truly stuck you can give up to see the answer, but that round isn't recorded.
  • Win and you see your guess count and elapsed time; your lowest guess count for each length is saved in your browser.

How big is the search space?

The answers are ordered selections of distinct digits from 0-9:

LengthPossible answers
3 digits10 x 9 x 8 = 720
4 digits5,040
5 digits30,240

You are never going to work through 720 one at a time. The whole game is about how much of that pool a single guess can eliminate.

A workable strategy

Step 1: find out which digits are in play. Spend your first two guesses on non-overlapping digits — 0123 then 4567 for a four-digit game. Add up the bulls and cows from both and you also know how many of the remaining 8 and 9 must be in the answer, without ever having guessed them.

Step 2: welcome an OUT. It looks like a wasted turn, but it eliminates four digits at once, which is the strongest single result you can get. Cross them off and never type them again.

Step 3: once the digits are known, only shuffle. Keep the same digits and change their order. Watching the bull count rise and fall tells you which digit belongs where. Swap exactly two positions and gain two bulls, and those two positions are settled.

Step 4: re-read the table before guessing again. When you're stuck, go back through the history from the top. Very often only one arrangement is still consistent with everything you've already been told, and it's sitting there in plain sight.

There is no guaranteed method. Nothing promises a win within a fixed number of turns, and a bad draw will cost you an extra guess or two. What the sequence above does reliably do is cut your average well below random guessing.

Working your way up

Only your lowest guess count is stored, separately for each length, so a good three-digit round never touches your four-digit record. It lives in the browser you played in, which means other devices and private windows start blank and clearing this site's data erases it.

Start at three digits until the deduction feels automatic, then move to four. Five digits has over thirty thousand candidates, and if you waste the opening guesses the middle game turns into serious bookkeeping.

Other tests on the site

This puzzle is all deliberation and no reflex, which makes it the opposite of the rest of the series. To measure pure reflex with the thinking stripped out, try the five-round reflex check. If you want to know what those millisecond numbers are worth, we put that in our notes on average reaction times.

For raw finger speed there's the clicks-per-second test, and for mouse precision the thirty-target aim drill. More thinking games, a memory test among them, are on the way.

Number Guessing Game FAQ

What are the rules?

The computer picks a number whose digits are all different. You guess a number with the same number of digits, and each guess comes back scored: a bull for every digit that is correct and in the right place, a cow for every digit that is in the number but in the wrong place, and OUT when none of your digits appear at all.

How many digits can I play with?

Three, four or five. Changing the length starts a fresh game, and your fewest-guesses record is kept separately for each length.

Can the answer start with zero?

Yes. Zero is allowed in the first position, so 047 is a valid three-digit answer. What can't happen is the same digit appearing twice.

What if I enter a repeated digit?

The game tells you straight away and the guess isn't spent. The same applies if the guess is too short to submit.

How many possible answers are there?

It's the count of ordered selections of distinct digits from 0-9: 10x9x8 = 720 for three digits, 5,040 for four and 30,240 for five. That's why each guess is worth planning — the aim is to cut the pool, not to get lucky.

Is there a guaranteed winning method?

No method guarantees a win in a fixed number of guesses. There are solid habits, though: spend your first two guesses on non-overlapping digits to find out which digits are even in play, and once you know the digits, reorder them to pin down positions.

Is this the same as Bulls and Cows or Mastermind?

It's the digit version, usually called bulls and cows. It's an old pencil-and-paper game that predates the boxed board game Mastermind, which Mordecai Meirowitz brought out in 1970 using coloured pegs instead of digits. In Korea and Japan the same game is played as number baseball, where the calls are strikes and balls.

Is there a solver or a hint button?

No. There's deliberately no solver and no hints — the deduction is the game. If you're stuck you can give up to reveal the answer, but that round isn't recorded.

What gets saved?

Your lowest guess count for each length, stored in the browser you played in. Other devices and private windows start empty, and clearing this site's data removes it.