Skip to main content
L
Loopaloo
Buy Us a Coffee
All ToolsImage ProcessingAudio ProcessingVideo ProcessingDocument & TextPDF ToolsCSV & Data AnalysisConverters & EncodersWeb ToolsMath & ScienceGames
Guides & BlogAboutContact
Buy Us a Coffee
L
Loopaloo

Free online tools for developers, designers, and content creators. Your files are processed in your browser and are never uploaded - no accounts required. A few network utilities (like What's My IP and Currency Converter) call public APIs to do their job and say so on their pages.

support@loopaloo.com

Tool Categories

  • Image Tools
  • Audio Tools
  • Video Tools
  • Document & Text
  • PDF Tools
  • CSV & Data
  • Converters
  • Web Tools
  • Math & Science
  • Games

Company

  • About Us
  • Contact
  • Blog
  • FAQ

Legal

  • Privacy Policy
  • Terms of Service
  • Disclaimer

Support

Buy Us a Coffee

© 2026 Loopaloo. All rights reserved. Built with privacy in mind.

Privacy|Terms|Disclaimer
  1. Home
  2. Games
  3. Mastermind
Add to favorites

Mastermind

Code-breaking puzzle. Guess the secret colour code from black and white pegs, with a live count of the codes still possible. Four difficulties, six modes

No account, nothing trackedMore gamesJump to full guide

Initializing in your browser…

You might also like

Sudoku

Sudoku with a guarantee most generators skip: every puzzle is checked to have exactly one solution before you see it. Difficulty is measured by the techniques a puzzle needs, and hints say why a digit belongs where it does.

Minesweeper

Minesweeper on the three standard boards or one of your own, with both first-click conventions offered by name: a safe square, or a safe square and its eight neighbours. Flags, question marks, chording and best times.

Breakout

Brick breaker with continuous collision, so the ball never passes through a brick and bounces off the face it actually hits. Power-ups, boss levels, upgrades and achievements.

A sample round

Your guess gets two black pegs and one white peg of feedback.

Guess + feedback

R G B Y  →  ●● (right colour+spot)  ○ (right colour, wrong spot)
What Mastermind produces

Deduction

Three of these four colours are in the code, one of them in the right place; the codes-left counter drops from 1,296

Black is right colour and right place, white is right colour and wrong place, counted from what is LEFT after the blacks have taken theirs, so a guess can never earn more pegs for a colour than the code contains. Combining that across guesses narrows the 1,296 possible codes, and the page shows how many are still consistent with everything you have been told. Knuth proved in 1976 that five guesses always suffice for four pegs from six colours; the Code Maker AI uses his rule and averages 4.48.

About this game

Crack a secret color code using logic and deduction. After each guess, you receive feedback telling you how many colors are correct and how many are in the right position. Can you break the code within the allowed attempts?

How to play

  1. 1A secret code of colored pegs is generated.
  2. 2Select colors to form your guess and submit it.
  3. 3Read the feedback: a black peg means right color, right position; a white peg means right color, wrong position.
  4. 4Use the feedback to refine your next guess. Solve the code before running out of attempts.

Tips & best practices

  • Start with a guess that uses all different colors to gather maximum information.
  • Pay close attention to white vs. black pegs, the distinction is crucial.
  • If a color gets zero feedback across guesses, eliminate it entirely.

Why play it

  • Logic skill development

    Each game is a structured deduction exercise that sharpens analytical thinking.

  • Teaching the scientific method

    Forming hypotheses and testing them against feedback mirrors real scientific inquiry.

  • Programming warm-up

    The elimination logic in Mastermind maps directly to debugging and constraint-solving skills.

  • Competitive puzzle challenge

    Race a friend to see who can crack the code in fewer guesses.

Controls and rules

  • Four difficulties from 4 pegs of 4 colours up to 5 pegs of 8
  • Black and white peg counts that handle repeated colours correctly
  • A live count of how many codes are still possible
  • Six modes including No Duplicates, Super, Daily and Code Maker
  • A Code Maker AI that uses Knuth's minimax rule
  • Guess history visible throughout the game
  • Solve-rate statistics
  • Color-blind friendly peg design

How to Think Like a Codebreaker

Mastermind rewards systematic thinking, and this version makes "narrows the possibilities" a number: a counter shows how many codes are still consistent with every answer you have been given, out of 1,296 for the standard four pegs from six colours. Two things decide whether a Mastermind is right, and both are about repeated colours. The pegs are counted in two passes: black pegs for the exact matches, then white pegs from what is LEFT on both sides, so a guess never gets more pegs for a colour than the code contains. Super mode's per-position rings are derived from the same calculation, so the two displays can never say different things. And the code itself is drawn as a shuffle rather than by redrawing a colour until it is new, which is what lets No Duplicates mode work at any length and palette. Knuth proved in 1976 that any of the 1,296 codes can be cracked in at most five guesses; the AI in Code Maker mode uses his minimax rule and needs 4.48 on average.

Frequently asked questions

How many guesses do I get?

The default is 10 attempts, but you can adjust the difficulty for more or fewer.

What do the feedback pegs mean?

Black peg = correct color in the correct position. White peg = correct color but wrong position. No peg = that color is not in the code (for that slot).

Is every code solvable within the guess limit?

For the standard four pegs from six colours, yes: Knuth proved in 1976 that five guesses are always enough, and the default limit is ten. Harder settings have larger code spaces, so the limit is tighter relative to the search.

What happens when the code repeats a colour?

The pegs are counted in two passes. Black pegs are taken first and each one uses up that colour on both sides; white pegs then come from what is left. So guessing three of a colour when the code holds two can never earn three pegs for it.

What does the codes-left counter mean?

How many of the possible codes still fit every answer you have been shown. It is a fact about the feedback, so you can check it, and it goes to one exactly when the code is forced.

Related tools and how they differ

  • Sudoku: Solve a number-placement grid by pure logic, easy through Evil, with notes and hints; pick it when clues are fixed and fully deducible, no guessing.
  • Minesweeper: Reveal a grid without hitting mines, reading number clues to flag bombs; pick it for spatial deduction where some positions stay uncertain.

Private by design

The game runs entirely in your browser. No account is needed and no gameplay data is collected.