Puzzle

Deduce the secret in Mastermind

Guess1/10
Best

right colour & place · right colour, wrong place.

Mastermind is the classic code-breaking puzzle. A secret row of four coloured pegs is hidden at the top of the board; you have ten guesses to reveal it. After each guess, black and white clue pegs tell you how close you are — and pure logic does the rest.

How to play

Mastermind in 4 steps

01

Build a guess

Tap the colour swatches to fill the four slots in your current row. Tap a slot again to clear it if you change your mind.

02

Submit the row

When all four slots are filled, press Check. The code stays hidden, but you get a row of clue pegs in return.

03

Read the clues

A black ● peg means one colour is right and in the right place. A white ○ peg means a colour is correct but in the wrong slot. Their order is not a hint.

04

Narrow it down

Use each clue to rule colours and positions in or out. Crack the code within ten guesses to win the round.

Controls

Tap colour / 1–6
Place that colour in the next slot
Tap a slot
Clear that slot
Enter
Check the current guess
Backspace
Remove the last peg
R
New secret code

Strategy

Tips to play better

Probe with pairs first

Open with rows that test two colours each (like A A B B). The clue counts quickly tell you how many of each colour the code contains before you worry about position.

Black plus white is the count

The black and white pegs together tell you how many of your colours appear anywhere in the code. That total is often more useful than the black pegs alone.

Change one thing at a time

When you are honing position, alter a single peg between guesses. The change in the clue pegs then points directly at that one slot.

Track what is impossible

Every clue eliminates possibilities as much as it confirms them. Keeping a mental "this colour is not here" list shrinks the puzzle far faster than guessing.

About Mastermind

Mastermind was devised in 1970 by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert, and became one of the best-selling boardgames of the decade. Its pegboard of coloured and clue pegs turned a simple guessing game into a genuine exercise in deductive logic.

The maths underneath is surprisingly deep. With six colours and four positions there are 1,296 possible codes, yet Donald Knuth proved in 1977 that any code can be cracked in five guesses or fewer with the right strategy. That tension — a huge space tamed by clean logic — is what makes each round so satisfying.

This Unicode edition renders the code pegs and clue markers entirely from recoloured circle glyphs on a neon board, so it is crisp on any screen and needs no images. Every code is randomly generated, allowing repeats, and your best (lowest) number of guesses is saved locally in your browser.

FAQ

Mastermind questions

How do I enter a guess?
Tap the colour swatches (or press number keys 1–6) to drop colours into the four slots of your active row, then press Check or Enter. Tap a filled slot to clear it.
What do the black and white pegs mean?
A black peg means one of your pegs is the right colour in the right position. A white peg means a peg is the right colour but in the wrong position. The clue pegs are not lined up with specific slots.
Can the secret code repeat colours?
Yes. A colour can appear more than once in the hidden code, so a four-peg code might use the same colour twice or even all four the same. Plan your deductions accordingly.
How many guesses do I get?
You have ten rows. Crack the code on any of them to win; if your tenth guess is wrong, the code is revealed and the round ends.
Is it really free?
Completely free, with no ads, no sign-up and nothing to install. Your best score is saved locally in your browser.