← All text tools

Code-Breaker and Bulls and Cows Solver

Enter each guess with its black and white pegs, or bulls and cows, and see how many secret codes are still possible and which guess to try next.

  • Free
  • No sign-up
  • Works on any device

About Code-Breaker and Bulls and Cows Solver

Helps you crack the secret code in a colour-peg game or Bulls and Cows. Choose the game, the code length, the number of colours and whether repeats are allowed, then list each guess you made on its own line with the feedback, for example ABCD 1 2 for one black peg and two white pegs. The page lists how many secret codes are still possible, and suggests the next guess that leaves the fewest codes in the worst case (Knuth's minimax idea). In the standard game a first guess AABB with no pegs leaves 256 of 1,296 codes; 1234 with no bulls or cows leaves 360.

How to use Code-Breaker and Bulls and Cows Solver

  1. Pick the colour-peg game or Bulls and Cows and set the code length, number of colours and repeat rule.
  2. Type your guesses, one per line, as the code followed by black pegs (or bulls) and white pegs (or cows).
  3. Read how many codes remain, play the suggested next guess, and add its feedback as a new line.

Why use this tool?

Also known as

Frequently asked questions

How do I write the colours in the colour-peg game?

Use the letters A to H: A red, B blue, C green, D yellow, E orange, F purple, G pink and H brown. Digits 1 to 8 also work. Bulls and Cows uses the digits 0 to 9.

What do black and white pegs mean, and bulls and cows?

Black pegs, or bulls, are right symbols in the right place. White pegs, or cows, are right symbols in the wrong place, counted without reusing a peg twice.

Why does it say no code fits my feedback?

At least one line contradicts the others, usually because the black and white counts were swapped or mistyped. Check each line against the game; the solver never guesses past a contradiction.

Is Code-Breaker and Bulls and Cows Solver free?

Yes. Code-Breaker and Bulls and Cows Solver on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.

Can I put Code-Breaker and Bulls and Cows Solver on my own website?

Yes. Use the Embed on your site button under the tool to copy a short piece of code and paste it into your page. It is free, needs no account, and the tool keeps working inside your page.