Play Code Breaker online, the classic deduction game of coloured pegs. One side hides a secret code; the other guesses it, and after each guess small black and white key pegs tell you how close you are. Play solo against the computer, which sets a fresh code every round, or with 2 to 4 people on one phone, tablet or computer, taking turns to set codes for each other. A round takes two to six minutes. It is free, needs no sign-up and works offline once the page has loaded.
How to play Code Breaker
- The secret code is a row of 4 coloured pegs, chosen from 6 colours. Colours can repeat unless you switch Repeated colours off.
- Make a guess: tap a colour to fill the selected hole, or type its number from 1 to 6. Tap a hole to change it, and use Delete to take a peg out.
- Tap Check. Each black key peg means one of your pegs is the right colour in the right place. Each white key peg means a right colour in the wrong place.
- The key pegs are shown in a fixed order, blacks first, so they never say which peg they mean. Work it out by comparing guesses.
- Every colour has its own shape (a circle, square, triangle, diamond, star and cross), so the pegs can be told apart without relying on colour.
- Get four black pegs to crack the code. You have 10 guesses, or 12 if you choose. If they run out, the code setter wins, and the code is revealed either way.
For a worked example, the bigger 5-peg board and the scoring, read the complete Code Breaker rules.
Play 2 player Code Breaker on one device
Code Breaker for 2 players needs only one screen. Set Number of players to 2, 3 or 4 and type the names.
- The code stays secret. Before the code setter chooses, a pass screen asks everyone else to look away. The setter fills the holes from the palette, or taps Random for a surprise, then Set the code. A second pass screen hands the device to the code breakers. The code is never shown on the board until the round ends.
- Breakers take turns. With three or four players, the breakers make one guess each and win or lose the round together.
- A new setter every round. Rematch passes the job of setting the code to the next player. Each round you win, as a breaker or as the setter who held out, adds a point to the session score.
- Auto-save, no Undo. Every guess is saved, so a refresh does not lose the round, and the game runs without Wi-Fi. There is no Undo: the key pegs appear at once, and taking a guess back would hand back a guess you have already learned from. Change pegs as much as you like before you tap Check.
Because everyone sees the same rows of pegs, the game also works on a classroom display, with the class suggesting each guess together.
Play against the computer
Playing alone? Keep Number of players at 1, and a hidden computer sets the secret code for you, picked at random from every code your options allow. It never chooses with your guesses in mind, so every code is as likely as any other. You choose the board before you start:
- Code: 4 colours of 6 (1,296 possible codes), 5 colours of 8 (32,768 codes) or 4 digits (Bulls and Cows, 5,040 codes).
- Repeated colours: on for the classic game, off for an easier start where every place is a different colour.
- Guesses (under More options): 10 or 12.
4 colours of 6 with Repeated colours off is a gentle first game for children. 5 colours of 8 asks for careful notes in your head, even from adults.
Quick tips
- Open with two pairs, such as red, red, blue, blue. It splits the possible codes better than four different colours.
- Count before you place. Black plus white tells you how many pegs of those colours are in the code. Find the colours first, then the places.
- Only guess codes that could be right. Before you tap Check, make sure your guess agrees with every earlier row of key pegs.
The Code Breaker strategy tutorial walks through a whole game, guess by guess, and shows a simple method you can follow in your head. For more quick paper classics, see our list of pen and paper games. For another guessing game on one screen, try Hangman or Sea Battle.


