← Back to Home

How to Play Bulls & Cows: Rules, Example & Strategy

Everything you need to crack the 4-digit secret code faster — from official rules and a full worked example to math-backed opening tactics.

Official 4-Digit Bulls & Cows Rules

Bulls and Cows (also known as Cows and Bulls or 4-digit Mastermind) is a pure deduction puzzle. Your goal is to uncover a hidden 4-digit code made of unique digits from 0 to 9 in as few guesses as possible.

Bull — Right digit, right spot

Each Bull means one digit in your guess is in the secret code AND sits in the exact same position.

Cow — Right digit, wrong spot

Each Cow means one digit in your guess appears in the secret code, but belongs in a different position.

  • The secret code always has 4 unique digits chosen from 0 to 9 (no repeated digits; leading zero is allowed).
  • Submit any 4 unique digits as your guess to receive a clue counting Bulls and Cows.
  • Use your previous clues to eliminate impossible digits and lock in confirmed positions.
  • Reach 4 Bulls to crack the code and win — in Solo mode, against the AI, or before your friend in 1v1 multiplayer.

Step-by-Step Worked Example

Suppose the hidden secret code is 5296. Here is how systematic deduction cracks it in just 4 turns:

#11 2 3 4 1 0

1 Bull, 0 Cows: exactly one digit from {1, 2, 3, 4} is in the code and already in its right spot. We test four brand-new digits next.

#25 6 7 8 1 1

1 Bull, 1 Cow: two digits from {5, 6, 7, 8} are in the code. That accounts for 3 of the 4 secret digits so far, meaning exactly one of {9, 0} must also be in the code.

#35 2 9 0 3 0

3 Bulls, 0 Cows: locking in 5 and 2 while testing 9 and 0 reveals three exact positions at once. Only one digit (0) is wrong and needs swapping with a candidate from guess #2.

#45 2 9 6 4

4 Bulls — Code cracked! Replacing 0 with 6 from {5, 6, 7, 8} completes the exact secret 5296.

Winning Strategy & Pro Tips

With 10 × 9 × 8 × 7 = 5,040 possible 4-digit codes, disciplined information gathering beats random guessing every time. Most skilled players solve any code in 5 to 6 moves.

1. Open with two disjoint guesses (1234 → 5678)

Testing 8 distinct digits in your first two moves immediately tells you how many of {9, 0} are in the code (4 minus the total Bulls + Cows from both guesses).

2. Zero-clue turns are pure gold

Getting 0 Bulls and 0 Cows removes 4 digits from the board in one shot, shrinking the search space from 5,040 down to just 360 remaining codes.

3. Use the built-in digit marker

Long-press (or right-click on desktop) any digit on the keypad to mark it as ruled out or confirmed. Visual elimination prevents repeating dead digits.

4. Swap positions deliberately

When you know the digits but have Cows instead of Bulls, rotate two or three digits at once while keeping confirmed Bulls anchored.

Frequently Asked Questions

Can the secret code start with 0?

Yes. Any digit from 0 through 9 can appear in the first slot, as long as all four digits in the code are distinct.

Are duplicate digits allowed in Bulls and Cows?

No. Every digit in the 4-digit secret code and in your guesses must be unique.

What is a good average number of guesses?

An optimal solver averages about 5.21 guesses and never needs more than 7. Human players who use disjoint opening guesses typically average 5 to 7 turns.

How does online 1v1 multiplayer work?

Open the Play with a Friend page, click Create session, and send the invite link via WhatsApp, Telegram, or any chat app. Both players race to crack the code in real time with no login required.

How is Bulls and Cows different from Mastermind and Wordle?

Bulls and Cows is the original 19th-century pencil-and-paper logic game that inspired both Mastermind (colored pegs, repeats allowed) and Wordle (5-letter words with per-slot color feedback).

Ready to test your strategy?

Jump straight into a free browser match — no account or download required.