Code Breaker

A secret code of four colors has been set. After each guess: ⚫ = right color, right position; ⚪ = right color, wrong position. Crack it in ten tries.

Guess 1/10Wins 0Colors can repeat
Pick four colors, then press Check guess.

How to play

A secret code of four colors is picked from a palette of six, and colors can repeat. Click colors from the palette to fill the four slots of your current guess, then press "Check guess" to lock it in. Each guess earns feedback pegs: a black peg (⚫) for every position where your color matches the secret exactly, and a white peg (⚪) for every color you guessed correctly but placed in the wrong slot. The pegs tell you counts, not which specific slots are right, so you have to cross-reference feedback across multiple guesses to narrow down the code. You get ten guesses per code — click "Clear" to wipe your current guess, or "New code" to start over with a fresh secret.

Frequently asked questions

Are my wins saved?

Yes — your win count is saved locally in your browser and persists between visits on the same device, so it keeps climbing every time you crack a code rather than resetting each session. It's stored in your browser's local storage, not on a server, so it won't follow you to a different browser or device, and clearing your browser data will reset it to zero.

Is ten guesses always enough?

Comfortably, if you deduce logically rather than guess randomly. With perfect play, any 6-color, 4-peg code can be cracked in at most five guesses — mathematician Donald Knuth proved this in 1977 with an algorithm that always finds the answer within that bound. Ten guesses gives you plenty of room even if you're not playing optimally, as long as you actually use the feedback from each attempt instead of ignoring it.

What's a good opening guess?

Two pairs — for example red-red-blue-blue — splits the possibilities efficiently and is the starting move in Knuth's five-guess algorithm. It tests two colors at once, and the mix of black and white pegs you get back rules out a large chunk of the remaining possibilities immediately, which is a stronger opener than four different colors or four of the same color. From there, use each round's feedback to eliminate whole families of combinations rather than guessing at random.

Last updated: 2026-07-22