Play Code Breaker online: crack the hidden colour code

Guess a hidden row of coloured pegs and read the clues. A daily code, random codes, 4 or 5 pegs, 6 or 8 colours, numbered pegs, hints and a possibilities counter.

How it works

  1. Choose Daily or Random, or open Setup for 5 pegs, 8 colours, no repeats or a different number of guesses
  2. Tap colours to fill the row, or press 1 to 8, then press Check guess or Enter
  3. Read the clues, a filled dot for the right colour in the right place and a ring for the right colour in the wrong place, and keep guessing until the row matches

How a round works

Code Breaker is a logic game where you guess a hidden row of coloured pegs and every guess is answered with clues that say how close it was. The page picks a secret code of 4 pegs from 6 colours, and a colour may appear more than once, so there are 1296 possible codes. You have 10 guesses. After each guess you get one marker per correct peg: a filled dot means the right colour in the right place, and a ring means a colour that is in the code but in a different place. The markers are sorted, so they never say which of your pegs earned them. You win when all four markers are filled dots. Each peg counts once, and exact matches are taken first. Worked example: with the code 1 1 2 3, the guess 1 2 1 4 scores one filled dot and two rings. The first peg is exact. Of the rest, the 2 and one of the 1s are in the code but misplaced, and the 4 is not in the code. A guess of 1 1 1 1 against the code 1 2 3 4 scores a single filled dot, because the code holds only one 1. Under Setup you can choose 5 pegs, 8 colours, 8, 10 or 12 guesses, or each colour once at most. The largest setup, 5 pegs and 8 colours with repeats, has 32,768 codes. Without repeats the standard setup has 360 codes and the largest has 6720.

Daily code, random codes and colour-blind play

Every peg shows a number from 1 to 8 as well as a colour, and the colours are named for screen readers, so the game can be played without telling hues apart: 1 is red, 2 orange, 3 yellow, 4 green, 5 blue, 6 purple, 7 pink and 8 grey. The Daily code always uses the standard setup, and the date on your device decides it, so anyone with the same date gets the same code. A new daily starts at your own midnight, and the page checks the date again whenever you come back to the tab. Finishing a daily counts once for that day and builds a daily streak. Random codes have a code number that you can see in Setup and in the result; the same number with the same setup always gives the same code. The code is worked out on your device from that number, and nothing about your guesses is sent anywhere.

How to solve it in fewer guesses

Start with a guess that uses two colours twice, such as 1 1 2 2, because it tests two colours at once. If it scores nothing, colours 1 and 2 are out and only 256 of the 1296 codes are left. After that, always guess a code that would have produced every clue you have seen so far. This is the Hint button's rule: it fills the row with one of the codes that still fit. In the tests, a player who always takes the first code that fits, in a fixed order, cracks every one of the 1296 standard codes within 8 guesses, and the average is 5.0, so 10 guesses are enough for careful play. Turn on Show how many codes still fit in Setup to see how fast the clues narrow things down. A hint is not a cheat code: the result shows how many hints you used, and a game with a hint does not count toward your fewest-guesses record.

Controls, saving and what is not included

Tap a colour to put it in the selected peg and move to the next empty one, or tap a peg to select it; tapping a filled selected peg clears it. With a keyboard, the keys 1 to 8 set the selected peg, Backspace or Delete clears it, the left and right arrow keys move between pegs, and Enter checks a full row. The game in progress is saved in this browser for each code, so closing the tab does not lose it, and your wins, win streak, daily streak and fewest guesses in a standard game are kept too. The status line and the live region read out each clue and the end of the game. This page has no online play, no timer and no sound. If you run out of guesses the code is shown.

Frequently asked questions

How many guesses does it take to crack a 4-peg, 6-colour code?

About 5 on average if every guess fits all the clues so far. In the tests, always taking the first code that fits cracked all 1296 standard codes in 8 guesses or fewer. This page gives 10 guesses by default, and the Hint button makes this kind of guess for you.

What do the filled dots and rings mean in Code Breaker?

A filled dot is a peg with the right colour in the right place. A ring is a peg with a colour that is in the code but in a different place. For the code 1 1 2 3, the guess 1 2 1 4 scores one filled dot and two rings. The markers are sorted, so they do not point at particular pegs.

Can a colour appear more than once in the code?

Yes, by default. With repeats on there are 1296 codes for 4 pegs and 6 colours. Choose Each colour once in Setup to remove repeats, which leaves 360 codes. Repeats change the clues too: the guess 1 1 1 1 against the code 1 2 3 4 scores one filled dot and no rings.

Is the daily code the same for everyone?

It is the same for everyone whose device shows the same date. The date and the game name decide the code, and a new one starts at your own midnight. The Daily code always uses 4 pegs, 6 colours, repeats on and 10 guesses, and a finished daily counts once toward your daily streak.

How can I play if I cannot tell the colours apart?

Every peg carries a number from 1 to 8, and the keys 1 to 8 set a peg directly. For example 1 is red, 4 is green and 8 is grey. Screen readers hear each peg as its number and colour name, such as 3 Yellow, and each clue is read out in words.

Are my guesses uploaded anywhere?

No. The game is processed in your browser and not uploaded. Your setup, the game in progress and your win record are saved in this browser's local storage. The page counts visits with Google Analytics, such as that a game was started or won, never your guesses or the code.