Find the digits first
Two opening guesses without repeats, e.g. 1234 and 5678, show how many digits are in each group. If together they give fewer than 4 hits, the missing digits are 9 or 0.
The classic number code-guessing game. Rules, an example, strategy and a free game with friends in your browser.
Bulls and Cows (also called Cows and Bulls) is a logic game for two players in which you have to guess a secret code made of digits. All you need is paper and a pen, and the hints after each guess let you narrow down the possible answers step by step.
The game is older than the Mastermind board game, and computer versions of it were written as early as the late 1960s. It is still a great way to practise logical thinking and ruling out possibilities.
You will find the exact rules of the online version, including game modes and time limits, on the page Game rules.
This is how a game could go when the secret code is 7041.
| Attempt | Score | What it tells you |
|---|---|---|
| 1234 | 0 🐂 2 🐄 | No digit is in its place, but two of 1, 2, 3, 4 are in the code. |
| 5671 | 1 🐂 1 🐄 | One digit is in the right place, another is in the code somewhere else. You can cross out 5 and 6. |
| 7401 | 2 🐂 2 🐄 | All four digits are right; two of them need to swap places. |
| 7041 | 4 🐂 0 🐄 | Four bulls: code cracked in 4 guesses. |
Two opening guesses without repeats, e.g. 1234 and 5678, show how many digits are in each group. If together they give fewer than 4 hits, the missing digits are 9 or 0.
When a guess has no bulls and no cows, you can cross out all of its digits at once. Your next guesses get much easier.
Once you know the digits, move them one at a time. Every swap that changes the number of bulls tells you where a digit belongs or where it certainly does not.
Before you guess, check that your code would give the same results for all your previous guesses. It is the simplest way not to waste moves.
Guess The Code is an online version of Bulls and Cows for 1–4 players. Everyone sets a secret code and guesses the rivals’ codes, and the game counts the bulls and cows for you. You can play with friends over the internet, against a bot, on one phone in Hot Seat mode, or solve the daily puzzle.
Go to the home page, click “Create lobby”, then add a bot or send your friends the lobby code. No download and no sign-up.
The step-by-step guide shows how: How to play?.
Mastermind is a board-game version of the same puzzle: coloured pegs instead of digits, and black and white key pegs instead of bulls and cows. The logic is the same.
Wordle works in a similar way, but with words, and it shows a colour for each letter. In Bulls and Cows you only get the counts, so you have to work out yourself which digits were hits.
Yes. In Guess The Code you create a lobby, send your friends a 6-character code and play together in the browser, on a phone or a computer. Up to 4 people per game.
Yes. You can guess a code made up by the computer in Solo mode, or add a bot to the lobby and play against it.
Not in the classic version, where each digit appears once. In Guess The Code digits can repeat and a code can start with zero, which makes the puzzle a little harder.
In the classic version with 4 different digits there are 5040 possible codes. With the best strategy every one of them can be cracked in at most 7 guesses, a little over 5 on average. Without a computer it usually takes a few more.
Yes. Guess The Code is free, runs in your browser and needs no download or account.