Play Mastermind Online Free, 2 Player in Your Browser

Want to play Mastermind online with a friend, with no download and no account? My MP Games puts the classic code-breaking game in your browser. One player sets a secret row of four colours. The other player guesses, and each guess comes back with black pegs for a colour in the right place and white pegs for a colour that is in the code but in the wrong place. You have ten guesses to crack the code. Send a friend a room code, share one device, or practise against the computer — it runs on desktop, tablet and phone, and a game starts in seconds.

How to Play Mastermind

Choose a Mode

Pick Create room to invite a friend, Join room if you already have a code, Local vs to pass one screen, or Play vs Computer for a solo game. In vs Computer the computer sets a random code and you are the guesser. You can also set a code yourself and watch the computer try to break it, on Easy, Medium or Hard.

Set the Code

The setter picks four colours from a palette of six: red, orange, yellow, green, blue and purple. Colours may be repeated. In Local vs, the other player should look away until the code is locked in. Online, only the setter sees the secret until the game is over.

Guess and Read the Pegs

The guesser fills a row of four and submits it. Black pegs mean right colour and right place. White pegs mean right colour, wrong place. A colour is never counted twice. Use the feedback to narrow the options, then guess again. Break the code in ten guesses or fewer, or the setter wins that code.

Mastermind Rules

  • The secret is four pegs, each one of six colours. Duplicates are allowed.
  • The guesser has ten attempts.
  • A black peg is an exact match (colour and position).
  • A white peg is a correct colour in the wrong position.
  • The same secret peg cannot score both black and white.
  • If the guesser hits four black pegs, they win that code. If the tenth guess is wrong, the setter wins.
  • In a two-player match you can swap roles and play another code.

Controls

Touch and Mouse

Tap or click a colour, then tap a peg in the current row. Press Guess (or Set code, if you are the setter). Clear removes the row so you can start it again.

Keyboard

Keys 1 to 6 pick a colour. Arrow keys move along the row. Backspace clears a peg. Enter locks in a complete row.

Game Modes

Online With Friends (Room Code)

Create a room, share the five-character code or invite link, and play Mastermind online with a friend in real time. One of you sets the code; the other guesses. Friends can also watch as spectators, and they will not see the secret until the code is over.

Local 2 Player on One Device

Choose Local vs to play on a single phone, tablet or computer. The setter locks the code, then the screen passes to the guesser. Look away while the other person is acting.

vs Computer

Play vs Computer to break a random code on your own. Or set a code and let the computer guess: Easy tries random rows, Medium only plays guesses that fit the pegs so far, and Hard uses a minimax search that usually cracks the code well inside ten guesses.

Tips and Strategy When You Play Mastermind Online

  1. Start with two colours. A first guess such as two reds and two oranges tells you a lot about which colours are in the secret.
  2. Trust the pegs, not a hunch. If a later guess disagrees with earlier black and white counts, that guess cannot be right.
  3. Place the blacks first. Once a colour is known to be exact, keep it there and spend the remaining pegs testing the rest.
  4. Remember duplicates. Two black pegs on a guess with two reds can mean two reds in the secret, not one.
  5. Do not waste a late guess on a long shot. On guess eight or nine, play a row that is still consistent with every peg you have.

A Short History of Mastermind

Mastermind was invented by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert, and released by Invicta Plastics in 1970. The original board used coloured pegs and a plastic decoder shield, and it went on to sell tens of millions of sets. The underlying idea is older still: it is a close cousin of the pencil-and-paper game Bulls and Cows, where digits stand in for colours. The game you play here follows that classic rule set — four positions, six colours, black and white feedback — in the browser, so you can play Mastermind online with a friend instead of passing a physical board across a table.

Play Mastermind online: a 4-colour secret code and rows of black and white pegs

Mastermind FAQ

Can I play Mastermind online with a friend?

Yes. Create a room, share the code or invite link, and one of you sets the code while the other guesses. You can also play Local vs on one device, or vs the computer.

Is this the real Mastermind peg game?

Yes. This is the classic 4-colour-row game with six colours, ten guesses, and black and white pegs. It is not a number-guessing duel.

Are repeated colours allowed in the code?

Yes. The setter may repeat colours. A colour is only scored once in the feedback, so two reds in a guess only earn as many pegs as there are reds in the secret.

What do the black and white pegs mean?

A black peg means a colour is in the right place. A white peg means a colour is in the code but in the wrong place. The same secret peg cannot score both.

Can I play Mastermind against the computer?

Yes. In vs Computer the computer sets a random code and you guess. You can also set a code and let the computer guess on Easy, Medium or Hard.

Do I need an account or a download?

No. You can play Mastermind online free in the browser, with no download and no account.

Who invented Mastermind?

Mordecai Meirowitz invented it, and Invicta Plastics released the board game in 1970. It is based on the earlier pencil game Bulls and Cows.

More Puzzle and Mind Games for Two

After you play Mastermind online, try a more 2 player games online page, a Simon game online, a memory game 2 player, higher or lower online, or Hangman online with a friend.