Back
🐂 🐄 🔢

Bulls & Cows
online with a friend

The original code-breaking duel, and the ancestor of Mastermind. You each get a secret four-digit code, and you take turns trying to crack the other one first.

▶ Play Bulls & CowsFree · no signup · just share a link

How to play

  1. Each player is given a secret 4-digit code with no repeated digits. You can see your own code — your opponent is hunting it.
  2. Take turns guessing your opponent's code. After each guess you get feedback.
  3. 🐂 Bull = a correct digit in the correct position. 🐄 Cow = a correct digit in the wrong position.
  4. The first player to score 4 bulls — a perfect match — wins the game. Both codes are revealed at the end.

Strategy & tips

  • Bulls and cows are exclusive. A digit is either in the right place (bull) or in the wrong place (cow) — never counted as both. Guessing 1234 against the code 1567 gives you one bull, not one bull and one cow.
  • Bulls + cows is your first clue. Added together, they tell you how many of your four digits appear in the code at all, regardless of position. Work out which digits before you worry about order.
  • Open wide. Try 1234, then 5678. Two guesses cover eight of the ten digits and narrow the field dramatically.
  • Write things down and eliminate. Once you know which four digits are in play, the puzzle collapses into finding the right order — and there are only 24 of those.

Where it comes from

Bulls and Cows is decades older than Mastermind, which is essentially the same idea sold with coloured pegs. It's also a favourite of computer scientists: Donald Knuth famously showed that a Mastermind code can always be cracked within five guesses using an optimal strategy. With 5040 possible four-distinct-digit codes, careful elimination beats luck every time.