Online Code Breaker Game
Crack a secret 4-slot color code chosen from 6 colors in 10 guesses. Green checks and yellow dots guide your logical deduction.
Runs in your browser. No data leaves your device.
About this tool
A Mastermind-style deduction game. The computer hides a code of 4 colours chosen from 6 (repeats allowed, 1,296 possible codes). You have 10 guesses; after each one, feedback tells you how many colours are in the right spot and how many are in the code but in the wrong spot.
Features
- Six colours, each with its own shape (circle, square, triangle, star, diamond, plus), so the game works without colour vision
- Feedback per guess: a green check for each right colour in the right spot, a yellow dot for each right colour in the wrong spot, a small gray dot for each guess peg that matched nothing (pegs are counts, not tied to slots)
- Feedback is counted with duplicates handled correctly (each secret peg is matched at most once)
- Tap a filled slot to clear it, or Undo to remove the last colour
- The secret code is revealed when the game ends
- Win / played tally saved on the device
- New mid-game asks for confirmation
How to use it
- Tap colours (or press 1-6) to fill the 4 slots of the current row.
- Press Submit Guess (or Enter).
- Read the feedback and refine your next guess.
- Crack the code within 10 guesses.
Inputs
- Colour palette buttons
- Slot buttons (tap to clear)
- Undo, Submit Guess and New buttons
- Keyboard: 1-6, Backspace, Enter
Outputs
- Guess rows with feedback pegs
- Status (guess number, cracked in N, out of guesses)
- Won / played with win percentage
Limits and notes
- Feedback pegs are listed in a fixed order (checks first), not by slot position
- A game in progress is not saved; stats are stored in localStorage (overtooled:code-breaker:stats)
Keyboard shortcuts
- 1-6: add a colour
- Backspace: remove the last colour
- Enter: submit the guess (or start a new game after the game ends)
- Esc: hide the result card
Frequently Asked Questions
How does Code Breaker work?
A secret code of 4 colours is picked at random from 6 options, with repeats allowed (1,296 possible codes). Feedback is computed in two passes: first exact matches (right colour, right spot), then right colours in the wrong spot, matching each secret peg only once so nothing is double-counted. You get 10 guesses.
How do the feedback pegs work?
A green check means one of your colors is correct and in the correct position. A yellow dot means one of your colors is in the code but in the wrong position. A gray dot marks a guess peg that matched nothing, such as a second red when the code has only one. The pegs are counts, not tied to slots.
What is the best strategy?
Start with a guess that uses all different colors to maximize information. Use the peg feedback to systematically eliminate colors and positions. Most codes can be cracked in 4-6 guesses with logical deduction.
How many possible codes are there?
With 6 colors and 4 positions (allowing repeats), there are 1,296 possible codes. The feedback pegs give you enough information to narrow this down with each guess.