Free Classic · rules
Mastermindcode breaker
Four pegs, six colours, ten tries. Mastermind is a game of pure deduction — and it has been proven that any combination can be found in five guesses at most.
Goal of the game
Find the secret combination of four coloured pegs, in the right order, in as few guesses as possible.
After each guess you get clues — but without knowing which positions they refer to. That is the whole difficulty.
Reading the clues
- A black peg (or red, depending on the board): one peg is the right colour and in the right place.
- A white peg: one peg is the right colour but in the wrong place.
- No clue tells you which peg it is about. Two blacks mean “two are right”, not “the first two are right”.
- Clues are given in a neutral order, never in the order of the pegs: do not look for any positional match.
- Zero clues is powerful information: the four colours you played are completely absent from the code.
The best opening
- Do not start with four identical pegs: you only learn one thing, how many copies of a single colour there are.
- The best known opening is two colours, twice each — for example red, red, blue, blue.
- It tests two colours at once and tells you about both their number and their position.
- Second guess: keep what you have learned and bring in two new colours. You progress by halves.
The elimination method
- Establish the composition first, then the order. Knowing which colours are in the code is more useful than guessing their places.
- A guess that earns no clue at all eliminates four colours in one go: it is the best possible return.
- Once the composition is known, permute methodically: swap two pegs and read the change in the number of blacks. One more black, the swap was right; one fewer, it was the other way round.
- Note what each guess ruled out. Mastermind is lost mostly through forgetting, rarely through lack of logic.
The mistakes that cost the most
- Believing a clue refers to a position. The founding mistake: clues are anonymous.
- Changing three pegs at once. You will no longer be able to attribute the change in clues. Change one or two.
- Ignoring the total. Blacks plus whites gives the number of right colours, regardless of place: it is often the most usable information.
- Forgetting repeats. The same colour can appear two, three or four times. Players often wrongly assume four different colours.
Controls
Keyboard and mouse
- Click a slot to cycle through the colours, or pick one from the palette.
- The Check button is only active when all four slots are filled.
- The history of guesses and their clues stays on screen at all times.
Touch screen
- Tap a slot then a colour in the palette.
- Long-press a previous guess to copy it into the current row — handy for changing just one peg.
- The count of remaining tries is shown at the top.
Frequently asked questions
What do the black and white pegs mean?
Black: right colour, right place. White: right colour, wrong place. Neither tells you which peg it matches.
Can a colour appear more than once?
Yes, unless you play in no-repeat mode. Assuming four different colours is one of the most common mistakes.
What is the best first guess?
Two colours repeated twice each, for example red red blue blue. It brings more information than a combination of four different colours.
In how many guesses can you always win?
Five. It has been proven that with four pegs and six colours, an optimal strategy finds any code in five guesses at most.
What if a guess earns no clue at all?
That is excellent news: the four colours you played are absent from the code. You have just eliminated a large share of the possibilities in one go.
Play Mastermind
More classics, free as well
- Memory — turn over the pairs, collect the themes
- Word Search — a letter grid of French words, eight directions, a list to clear
- Nonograms — numbers on the edge, a picture to reveal