Play Bulls & Cows Online
Crack the secret 4-digit code using logic and deduction. Each guess tells you how many digits are correct and in the right place (Bulls) — and how many are correct but misplaced (Cows).
Enter your guess below
What Is Bulls & Cows?
Bulls & Cows is a classic code-breaking logic game that predates the famous board game Mastermind by more than a century. The computer picks a secret number — typically 4 digits chosen from 0–9 with no repeated digits. Your job is to crack the code in as few guesses as possible.
After each guess you receive two pieces of feedback:
- 🟢 Bulls — digits that are correct and in the correct position.
- 🟡 Cows — digits that exist in the secret code but are in the wrong position.
When you score 4 Bulls (or 5 or 6, depending on the difficulty), you've cracked the code. The game rewards careful logical deduction: every guess gives you information you can use to narrow down the possibilities.
How to Play
- Choose a difficulty. 4 digits is the classic mode. Try 5 or 6 digits for a tougher challenge.
- Enter a guess. Tap or type digits on the number pad. Each digit can only appear once in your guess.
- Read the feedback. Green = Bull (right digit, right place). Yellow = Cow (right digit, wrong place). Grey = Miss (digit not in the code).
- Deduce and guess again. Use the feedback from all previous guesses to eliminate impossible digits and narrow down positions.
- Crack the code! Score all Bulls to win. Then try to beat your personal best for fewest guesses.
Bulls & Cows Strategy Tips
1. Cast a Wide Net First
Your first two guesses should cover as many different digits as possible. For example, start with 1234 then 5678. This immediately tells you which digits are in the code and which are not — cutting the search space dramatically.
2. Focus on Identifying Digits Before Positions
It's usually more efficient to first figure out which four digits are in the code, then work out the order. If your first guess gets 1 Bull and 1 Cow, you know exactly 2 of those 4 digits are correct. Swap groups strategically to identify them.
3. Use Elimination Aggressively
If a guess returns 0 Bulls, 0 Cows, none of those digits are in the code — that's 4 digits eliminated at once. This is hugely valuable information. Keep track of which digits are confirmed in, confirmed out, or still uncertain.
4. Pin Down Bull Positions
If you got 1 Bull from a guess, try moving three of those digits and keeping one in place. If you still get a Bull with only that digit unmoved, you've confirmed its position. Repeat for each suspected Bull.
5. Think Like an Information Theorist
The optimal guess is the one that maximises information — meaning it divides the remaining possibilities as evenly as possible. In practice, this means choosing guesses that re-test uncertain digits in new positions, rather than repeating patterns you've already tried.
Bulls & Cows vs Mastermind
Both games share the same core mechanic: guess a hidden code, receive feedback, and deduce the answer. Here's how they differ:
- Code elements: Bulls & Cows uses digits (0–9). Mastermind uses coloured pegs (typically 6 or 8 colours).
- Duplicates: The classic Bulls & Cows code has no repeated digits. Mastermind often allows duplicate colours, making it harder.
- Feedback style: Bulls & Cows tells you exact Bull/Cow counts. Mastermind uses black and white pegs (same information, different presentation).
- History: Bulls & Cows is the older game, dating back to the 19th century as a pen-and-paper game. Mastermind was patented in 1970 by Mordecai Meirowitz and published by Invicta Plastics in 1971.
🎯 Want More? Try Our Mobile App
Love Bulls & Cows? Our dedicated Bulls & Cows app takes the Mastermind-style experience further with campaign mode, multiplayer, and unique one-guess logic challenges. Available free on Google Play.
Get it on Google PlayHistory of Bulls & Cows
Bulls & Cows has roots stretching back to the 19th century, where it was played as a pen-and-paper guessing game — long before any board game version existed. Players would take turns writing down secret numbers, and the terms "bull" and "cow" were used as livestock-themed shorthand for correct placements versus misplacements.
The game became widely known in computing circles in the 1960s and 1970s, when it was one of the first games programmed on early mainframe computers. The MOO program, written in various forms across university computer labs, challenged users to crack a 4-digit code — essentially the same game you're playing here.
In 1970, Israeli postmaster and telecommunications expert Mordecai Meirowitz created a physical board game version using coloured pegs instead of digits. After being rejected by every major toy company, it was finally published by Invicta Plastics in 1971 under the name Mastermind. The game became one of the best-selling board games of the 1970s and remains popular today.
The mathematical theory behind Bulls & Cows has been studied extensively. In 1977, Donald Knuth published an algorithm that can solve any Mastermind code in at most 5 guesses. For the no-duplicates variant (classic Bulls & Cows), optimal play averages about 5.21 guesses to crack any 4-digit code.
Frequently Asked Questions
More Puzzle & Strategy Games
If you enjoy Bulls & Cows, try these other free games on our site: