Edition: Classic Mastermind with a code of 4 pegs in 6 colors. Last checked October 25, 2026

Mastermind Rules: How to Play Mastermind

Mastermind is a logic game for two, where one player makes a secret color code and the other has to crack it. After each guess you get small clues. Here are the rules and answers to the questions that often cause debate.

Players
2
Age
8 and up
Playing time
20 to 30 minutes

How to win: The codebreaker tries to crack the code in as few guesses as possible. After an agreed even number of games, the player with the most points wins.

Who is right?

The classic arguments at the table when you play Mastermind.

Can the code use the same color more than once?

Yes, if you agree on it.

Official rule

In classic Mastermind the code may repeat colors. Agree on it before you start. Key pegs are only given for as many pegs of a color as there are in the code.

Common house rule

With kids and beginners, many play with four different colors. That makes the game easier.

Can you leave a hole empty in the code?

Only if you agree on it.

Official rule

Blank holes are an optional rule. If you use them, a blank counts as an extra color, and the codebreaker may guess blanks too.

Common house rule

Most families play without blanks.

Do the key pegs have to line up with the pegs they refer to?

No.

Official rule

Key pegs are placed in any order, for example black ones first. The codebreaker must not be able to tell which peg is right.

Common house rule

With young kids, some show on purpose which peg is right to make the game easier.

How many guesses do you get?

It depends on the board.

Official rule

You get as many guesses as there are rows on the board. That is usually between 8 and 12 depending on the edition.

Common house rule

Some families agree on fewer guesses, like 6, to make it harder.

What you need

  • A Mastermind board with rows of holes and a hidden area for the code
  • Code pegs in 6 colors
  • Small black and white key pegs

Setup

  1. 1One player is the codemaker, the other is the codebreaker.
  2. 2Agree whether the code may repeat colors and whether blank holes are allowed.
  3. 3The codemaker secretly places 4 code pegs in the hidden area.
  4. 4Agree on an even number of games, so you both make the code the same number of times.

How to play

  1. 1The codebreaker places 4 pegs in the first row as a guess.
  2. 2The codemaker answers with key pegs next to the guess.
  3. 3A black peg means: right color in the right spot.
  4. 4A white peg means: right color, but in the wrong spot.
  5. 5No peg is given for a color that is not in the code at all.
  6. 6The key pegs do not tell you which of the four pegs they refer to.
  7. 7The codebreaker guesses again in the next row, using the clues.
  8. 8The game ends when the code is cracked with 4 black pegs, or when the rows run out.
  9. 9Switch roles and play again.

Scoring

  • The codemaker scores 1 point for each guess the codebreaker uses.
  • If the code is not cracked, the codemaker scores 1 bonus point.
  • After the agreed number of games, the player with the most points wins.

House rules

Pick the rules you want to play with tonight. Everyone at the table has to agree.

Frequently asked questions

What do black and white pegs mean in Mastermind?

Black means right color in the right spot. White means right color in the wrong spot. Some editions use red instead of black.

Can you play Mastermind alone?

Yes, if someone else sets the code for you, or if you play a digital version where the computer makes the code.

What is Super Mastermind?

A harder version with 5 holes in the code and more colors to choose from.

Source: The publisher's rules for classic Mastermind and common family tradition. The rules are written in our own words. Ask the referee if you are unsure.