Play Code Breaker code-breaking game free in your browser. Guess the secret color code using logic. No download required.
The game generates a secret sequence of colored pegs, typically four positions from a set of six colors, with colors repeating allowed. Make a guess by arranging pegs in the same number of positions. After each guess, you receive feedback: a black peg for each peg that is the correct color in the correct position, and a white peg for each peg that is the correct color in a wrong position. Use this feedback to narrow down the hidden sequence within the allowed number of guesses.
The most effective approach is systematic. Your first guess should contain distinct colors with no repeats, covering as many different colors as possible in one attempt. After receiving feedback, eliminate all color-position combinations that are inconsistent with the clues received. On subsequent guesses, choose an attempt that maximizes the information you expect to receive regardless of what the answer turns out to be. With disciplined elimination, most four-peg codes are solvable within five guesses.
Code Breaker was created by Israeli postmaster and telecommunications expert Mordecai Meirowitz and released by Invicta Plastics in the United Kingdom in 1971. It appeared in North American toy stores shortly afterward and became one of the most recognizable two-player games of the 1970s. The game prompted significant academic interest, with mathematicians and computer scientists publishing papers on optimal solving strategies. A version requiring five guesses or fewer for any four-peg, six-color game was proven possible, matching Meirowitz's original claim.
To make a guess, click the colored circles from the palette of six to fill the four code positions left to right. The pegs you have placed appear in the row of dashed slots above the palette. Made a mistake? Click the ✕ to remove the last peg you added. Colors can repeat, so a valid guess might use the same color twice or even four times. The submit button stays disabled until all four positions are filled, preventing accidental partial guesses. You get ten attempts total, and the counter at the top shows how many remain. Each completed guess drops into the history list with its feedback pegs, so you can scan every prior attempt while planning the next. There is no penalty for thinking; only submitted guesses count against your ten-attempt budget, so plan each row before committing.
After each guess, small feedback pegs appear beside it. A solid black peg means one of your pegs is the right color in the right position. A hollow white peg means a peg is the right color but sits in the wrong position. Crucially, the feedback does not tell you which specific pegs are correct, only how many of each type, and each code peg is counted once, so duplicate colors will not generate extra matches than the code actually contains. Two black and one white means two positions are perfectly right and one more color belongs somewhere else. Track these counts across rows: if adding a color increases your white count, that color is in the code; if a position swap converts a white peg to black, you have located it. Disciplined comparison of consecutive guesses is what cracks the code within the limit.
A black peg means one peg is the correct color in the correct position. A white peg means a peg is the right color but in the wrong spot. The feedback never says which of your pegs earned which marker, only the totals.
You have ten attempts to crack the four-color code. The counter at the top shows how many remain. If you do not match all four positions exactly within those ten guesses, the game ends and reveals the secret sequence so you can see what it was.
Yes. The code is four positions drawn from six colors with repeats allowed, so a code could be two reds and two blues, or even all four the same color. Assuming every color is unique is a common early mistake that wastes guesses.
Open with four different colors, such as red, blue, green, and yellow. This tests four of the six colors at once and the peg feedback immediately tells you how many of those colors belong in the code, narrowing the field before you start worrying about positions.
Click colors to fill the four slots left to right, then click the ✕ to remove the most recently placed peg if you change your mind. The submit button only activates once all four slots are filled, so you cannot accidentally lock in an incomplete guess.