Code Breaker
Crack the secret color code using logic and deduction
4 positions · 6 colors · 12 attempts
No duplicates
What is Code Breaker?
Code Breaker is a classic logic and deduction puzzle game based on the timeless code-breaking concept. The computer generates a secret code made up of colored pegs, and your mission is to crack it using nothing but logic, pattern recognition, and the feedback you receive after each guess.
Originally popularized as a board game in the 1970s, this digital version brings the experience to your browser with modern enhancements: four difficulty levels from Easy to Expert, a hint system for when you get stuck, comprehensive statistics tracking, and a scoring system that rewards both speed and efficiency. Play for free — no downloads, no signup, no ads blocking your gameplay.
How to Play Code Breaker
Select from Easy (4 pegs, 6 colors) up to Expert (6 pegs, 8 colors). Higher difficulties allow duplicate colors in the secret code.
Click a position in the current row, then select a color from the palette below. Fill all positions to complete your guess.
After submitting, check the feedback pegs. Filled = right color, right spot. Hollow = right color, wrong spot. Empty = not in code.
Use deduction to narrow down possibilities. Crack the code before running out of attempts to win and earn points!
Understanding Feedback Pegs
Black (Filled) Peg
One of your colors is correct AND in the correct position. This is an exact match — keep this color where it is.
White (Hollow) Peg
One of your colors exists in the secret code but is in the wrong position. Try moving this color to a different spot.
Empty (No Peg)
This color is not in the secret code at all. Eliminate it from future guesses to narrow your options.
Note: Feedback pegs are shown in no particular order. They do not correspond to specific positions in your guess — only the total counts matter.
Strategies & Tips
Beginner Strategy
- Start with all different colors in your first guess to identify which colors are present in the code.
- Keep colors that earned black pegs in their exact positions for the next guess.
- If you get zero feedback for a guess, none of those colors are in the code — eliminate them all.
- Focus on finding the correct colors first, then worry about positioning.
Advanced Strategy
- Use your first two guesses to test all available colors (e.g., colors 1-4, then 5-6 plus two known).
- When you get white pegs, systematically try those colors in each remaining position.
- Count the total feedback pegs — if you have N colors identified and get N total pegs, you have found all the colors.
- On Easy mode (no duplicates), once you place a color correctly, it cannot appear elsewhere.
Pro Strategy
- Each guess should maximize information. Avoid repeating a guess pattern that tells you nothing new.
- Track which colors are "impossible" for each position based on accumulated feedback.
- On difficulty levels with duplicates, a color getting a white peg does not eliminate it from other positions.
- Optimal play on 4-peg 6-color games averages about 4.6 guesses — aim for under 5.
- Save hints for the endgame when you have narrowed down to 2-3 possibilities and need a tiebreaker.