Code Breaker is a free browser version of the classic Mastermind board game invented by Mordecai Meirowitz in 1970. Your goal is to deduce a hidden sequence of colored pegs using logical elimination. After each guess, black and white feedback pegs tell you exactly how close you are — no words, just pure logic.
Easy — 4 colors, no duplicates, 4 positions. Great for beginners.
Medium — 6 colors, no duplicates, 4 positions. The classic ruleset.
Hard — 6 colors, duplicates allowed, 4 positions. A significant jump in difficulty.
Expert — 8 colors, duplicates, 5 positions. Only for seasoned code-breakers.
After each guess you receive up to 4 feedback pegs (5 on Expert). A black peg means one of your colors is in exactly the right position. A white peg means one of your colors is in the code but in the wrong position. The pegs give no indication of which slot they refer to — that's for you to work out.
Choose a difficulty, then guess the secret color code by tapping colors into each position and submitting. After each guess you get black pegs (right color, right position) and white pegs (right color, wrong position). Use the feedback to narrow down the code in 10 guesses or fewer.
A widely used optimal first guess is two pairs of different colors — for example Red, Red, Blue, Blue. This strategy, proven by Donald Knuth, allows the solver to always crack any 4-peg, 6-color code in 5 or fewer guesses. In Easy mode (no duplicates), something like Red, Blue, Green, Yellow is ideal.
Mastermind is almost entirely logic. While the secret code is set randomly, a skilled player using systematic elimination can always solve the puzzle optimally. The game rewards deductive reasoning and process of elimination far more than chance.
Last updated: March 2026