CAN YOU BREAK THE CODE?

Mastermind Game

Crack the hidden code by analyzing clues, testing combinations, and using logic to uncover the secret sequence before you run out of guesses in this classic mind-bending puzzle.

Mastermind

About the Game

Mastermind is a classic code-breaking puzzle game for one or two players. The computer secretly creates a hidden code made of colored pegs. Your job is to work out that code using logic, deduction, and the clues you get after every guess.

This online version brings the feel of the physical board game to your browser. It has glossy, three-dimensional pegs, recessed peg holes, and a polished game board with seven board themes. Every color also carries its own symbol, so the game stays easy to read for players with color vision differences.

You can play on a desktop, tablet, or phone. Your game saves automatically, so you can refresh the page or come back later and pick up where you left off. The game also tracks your statistics, daily streaks, and achievements.

Mastermind rewards careful thinking over luck. Each clue narrows down the possibilities, and a good player can often crack the code in just a few guesses.

Objective

The objective is to find the hidden color code before you run out of attempts.

To win, your guess must match the secret code exactly, with every peg in the right color and the right position. In the standard game you get 10 attempts to crack a 4-peg code made from 6 colors. Fewer guesses mean a higher score.

How to Play

  1. Choose your game. Pick a game mode and a difficulty level, or keep the default Classic mode on Normal difficulty.
  2. Select a color. Click or tap a color in the palette below the board. You can also press the number keys 1 through 8.
  3. Fill the active row. Click an empty slot to place your selected color. You can fill the positions in any order. You can also drag a color onto a slot.
  4. Change your mind. Click a filled slot to remove its peg, or select a different color and click the slot to replace it. The Clear Guess button resets the whole row.
  5. Submit your guess. Once every position is filled, press Submit Guess or hit the Enter key. The row locks and the feedback markers appear.
  6. Read the clues. Use the markers to narrow down the code, then guess again.
  7. Win or lose. Crack the code to win and earn points. If you use all your attempts without cracking it, the secret code is revealed.

Reading the Feedback Markers

After each guess, small markers appear beside your row:

  • Gold circle: one peg is the right color in the right position.
  • Silver diamond: one peg is the right color but in the wrong position.
  • Empty hole: a peg adds no clue, which means its color is not in the code or it has already been counted.

The markers show only how many of each kind you earned. They never reveal which pegs are correct. The circle and diamond are different shapes, so you never need to rely on color alone to tell them apart.

Rules

  • The computer generates a secret code at the start of every game.
  • Each guess must fill every position in the row.
  • You get a limited number of attempts, which depends on the difficulty you choose.
  • Feedback is given after every guess. Exact matches (color and position) are counted first and set aside. Each remaining peg is then matched to a leftover peg in the code, and no peg is counted twice.
  • Some difficulty levels allow duplicate colors in the code. Others do not, so every color appears at most once.
  • You win when a guess matches the code exactly.
  • You lose when you use all your attempts or, in timed games, when the clock runs out.


Difficulty Levels

Level

Beginner

Easy

Normal

Hard

Expert

Master

Code Length

3

4

4

5

5

6

Colors

4

5

6

7

8

8

Attempts

8

10

10

10

8

10

Duplicates

Off

Off

On

On

On

On

You can also create a custom game. Choose a code length of 3 to 6 pegs, 4 to 8 colors, and 6 to 15 attempts. You can turn duplicates on or off, set a time limit of 2, 5, or 10 minutes, and switch hints on or off.


Game Modes

  • Classic Mastermind: the traditional game with standard feedback and no time limit by default.
  • Timed Challenge: crack the code before the countdown ends. Fast solves earn a time bonus.
  • Limited Attempts: you get three fewer guesses than usual, so every guess counts.
  • Endless Practice: play as many rounds as you like with no pressure, and track how you improve.
  • Daily Code Challenge: one new code each day, the same for everyone. You get one official attempt per day, and you can build a daily streak.
  • Two-Player Pass-and-Play: one player sets the secret code, then hands the device to the second player, who tries to crack it.

Scoring

A win earns 1,000 base points. You get bonuses for solving in fewer guesses, for unused attempts, for playing harder difficulties, for finishing quickly in Timed Challenge, and for completing the Daily Code. Each hint you use costs 150 points. A loss earns no points.

Tips and Tricks

  • Open with variety. Use a mix of colors on your first guess, such as two pairs (red, red, blue, blue). The feedback quickly shows which colors are in play.
  • Treat empty feedback as valuable. If a guess earns no markers, none of its colors are in the code. You can now ignore them for the rest of the game.
  • Add up the markers. The total number of markers tells you how many of your guessed pegs belong in the code.
  • Change one thing at a time. Swap a single peg between guesses to learn exactly what that change did to the clues.
  • Only play guesses that fit every clue. Before you guess, check that your guess could still be the answer given all previous feedback. This is the most reliable way to improve.
  • Test one color at a time when duplicates are on. Do not assume a color appears twice until the feedback supports it.
  • Use the strategy hint. It tells you how many codes are still possible and suggests a guess that fits all your clues. It costs 150 points, so save it for tough games.
  • Practice before you compete. Try Beginner or Endless Practice to build your instincts before you take on Expert, Master, or the Daily Code.
  • Review your game. After a win or loss, open Review Strategy. It shows how many codes remained after each of your guesses, so you can see which guesses helped the most.

Frequently Asked Questions

What is Mastermind?

Mastermind is a code-breaking game in which you guess a hidden sequence of colored pegs. After each guess you get clues about how close you are, and you use logic to work out the secret code.

How many guesses do I get?

In the default Normal difficulty you get 10 guesses. Other levels give between 8 and 10 attempts, and custom games let you choose anywhere from 6 to 15. Limited Attempts mode takes three guesses away.

What do the gold and silver markers mean?

A gold circle means one peg is the right color in the right position. A silver diamond means one peg is the right color in the wrong position. An empty hole means that peg adds no clue.

Do the markers show which peg is correct?

No. The markers show only how many pegs fall into each category. Their order never reveals which peg earned which marker.

Can a color appear more than once in the code?

It depends on the difficulty. Normal, Hard, Expert, and Master allow duplicate colors. Beginner and Easy do not. In custom games you can turn duplicates on or off.

How does the game handle duplicate colors in the feedback?

Exact matches are counted first and set aside. Each remaining peg in your guess is then matched against a leftover peg in the code at most once. This means a repeated color is never counted more times than it appears in the secret code.

What is the Daily Code Challenge?

It is a new code every day that is the same for every player. You get one official attempt per day, and your progress is saved if you refresh the page. Solving it on consecutive days builds a daily streak and earns bonus points.

Can I play Mastermind with a friend?

Yes. Two-Player Pass-and-Play lets one person build a secret code and then pass the device to the other player. A handoff screen keeps the code hidden.

Are there hints?

Yes, if hints are turned on. You get up to three hints per game. A hint can reveal a color in the code, check whether a color or position is correct, tell you whether the code repeats a color, or give a strategy suggestion. Each hint costs 150 points.

Is my progress saved?

Yes. Your current game, settings, statistics, daily streaks, and achievements are saved in your browser. You can refresh the page and continue where you left off.

What are the best strategies for winning?

Start with a varied first guess, use empty feedback to rule out colors, and always make guesses that fit every clue you have so far. The Tips and Tricks section above covers more.

Can I play on my phone?

Yes. The game adapts to phones, tablets, and desktop screens, and it works with touch, mouse, and keyboard.

Is the game accessible?

Yes. Every color has its own symbol, and the feedback markers use different shapes. You can switch on high contrast, larger pegs, larger text, reduced motion, and visible focus outlines. The game also supports full keyboard play.

What keyboard shortcuts can I use?

Press 1 through 8 to select a color, the left and right arrow keys to move between positions, Enter to submit, Backspace or Delete to clear a position, Escape to close a panel or pause a timed game, and R to start a new game.

Can I turn off the sound?

Yes. The sound button in the top bar mutes everything instantly. The settings also let you control sound effects, music, and volume separately.