Mastermind Strategy: How to Crack the Code in 5 Guesses or Less
Start with 4 different colors. Then use logic to eliminate possibilities — most codes can be cracked in 4-5 guesses with the right approach.
Signal is a code-breaking puzzle based on the classic Mastermind formula. The computer picks a secret sequence of colored pegs, and you have a limited number of guesses to crack it. After each guess, you receive feedback in the form of black and white pegs that tell you how close you are. Mastering Signal means learning to extract maximum information from every guess and narrowing the possibilities with ruthless logic. This guide will take you from guessing randomly to solving consistently in four or five attempts.
Understanding the Feedback: Black vs. White Pegs
The feedback system is the core of Signal, and misunderstanding it is the most common reason players struggle. A black peg means one of your colors is correct AND in the correct position. A white peg means one of your colors is in the secret code but in the wrong position. No peg for a color means that color either isn't in the code at all, or all instances of it have already been accounted for by other pegs.
The critical detail is that feedback pegs are not assigned to specific positions. If you guess Red-Blue-Green-Yellow and get one black peg, you know that exactly one of those four colors is in the right spot — but you don't know which one. This ambiguity is what makes the game challenging, and resolving it is what makes the game satisfying.
- Black peg: Right color, right position. One of your pegs is exactly where it should be.
- White peg: Right color, wrong position. The color exists in the code but needs to move.
- No peg: That color is not in the code (or is already fully accounted for). You can eliminate it.
First Guess Optimization: Start Strong
Your first guess sets the tone for the entire game. The optimal first guess uses four different colors because it gives you the maximum amount of information. If you repeat a color in your first guess, you learn less because you can't distinguish which instance of the repeated color is generating the feedback.
A classic opening is to pick the first four colors in order — for example, Red-Blue-Green-Yellow. This isn't about guessing correctly on the first try; it's about using the feedback to eliminate possibilities. If you get zero pegs back, you've just eliminated four colors entirely. If you get two white pegs, you know two of those four colors are in the code but in different positions. Every piece of feedback narrows the search space dramatically.
- Always use four different colors in your first guess. Maximum information, zero redundancy.
- Use a consistent first guess every game so you build pattern recognition for interpreting the feedback.
- Don't try to guess correctly on turn one. The goal is information, not luck.
Elimination Logic: Narrowing the Field
After your first guess, you should mentally (or physically) track which colors are confirmed, which are eliminated, and which are unknown. Each subsequent guess should be designed to resolve as many unknowns as possible.
If your first guess of Red-Blue-Green-Yellow returns zero pegs, your second guess should use entirely different colors — say, Orange-Purple-White-Pink (if available). This tests the remaining colors and will quickly identify which ones are in the code. If your first guess returns two white pegs, your second guess should rearrange two of those colors into new positions while introducing one or two new colors to test.
The principle is: never waste a guess confirming something you already know. Every guess should either test new colors or test new positions for known colors. If a guess doesn't give you new information, it was a wasted turn.
Interpreting Complex Feedback
The trickiest situations arise when you get a mix of black and white pegs. Say you guess Red-Blue-Green-Yellow and get one black peg and two white pegs. This tells you three of the four colors are in the code (one in the right spot, two in wrong spots), and one color is not in the code at all. But which one is the imposter?
To resolve this, your next guess should keep three of the four colors but shift their positions. For example, try Blue-Green-Yellow-Red. Compare the new feedback to the old feedback. If the black peg disappears, the color that was in the "right" position before (and is now in a different position) was responsible for it. If you gain a black peg somewhere new, that new position is correct for that color.
- Track your deductions. After each guess, write down what you know for certain and what's still ambiguous.
- Compare feedback across guesses. Changes in peg counts when you move colors around reveal which colors go where.
- Process of elimination: If you know three colors and their positions, the fourth slot must be whatever color remains.
Advanced Deduction: The Swap Technique
Once you know which colors are in the code but not their exact positions, use the swap technique. Take two colors whose positions you're unsure about and swap them while keeping everything else the same. If the black peg count goes up by two, both colors are now in the right position. If it goes down by two, they were both correct before and you've moved them to wrong positions (swap them back). If it stays the same, neither color was in either of those two positions.
This technique is the fastest way to lock down positions once you've identified the correct colors. It costs one guess to resolve two positions, which is highly efficient. In a six-color game, you might spend guesses one and two identifying colors, then guesses three and four using swaps to lock down all positions.
Solving in Under Five Guesses
Consistently solving in four or five guesses requires a disciplined approach. Here's a framework that works for the standard four-peg, six-color game:
- Guess 1: Four different colors. Goal: identify which colors are in the code.
- Guess 2: Based on feedback, either test remaining colors or rearrange confirmed colors. Goal: identify all four correct colors.
- Guess 3: Rearrange confirmed colors to resolve positions. Use the swap technique. Goal: lock down at least two positions.
- Guess 4: With two or three positions known, the remaining arrangement should be deterministic. Make your final guess.
This framework won't produce a perfect solve every single time — sometimes the feedback is ambiguous enough to require a fifth guess. But following this structure consistently will get you under five guesses in the vast majority of games.
Common Mistakes to Avoid
The biggest mistake is making a guess that doesn't test anything new. If you already know Red is in the code, including Red in every subsequent guess without changing its position doesn't give you additional information about Red — it just wastes a slot that could be testing something unknown.
The second most common mistake is ignoring previous feedback. Every guess must be consistent with all previous feedback. If guess one told you Red is not in the code (zero pegs and Red was included), then including Red in guess three is a wasted slot. Keep a mental ledger of confirmed facts and never contradict them.
- Never repeat a guess pattern that doesn't give you new information.
- Don't ignore previous clues. Every guess must be consistent with everything you've learned so far.
- Avoid guessing emotionally. Use logic, not hunches. The code doesn't care about your gut feeling — it only responds to deduction.