Home

Wordle Solver

Enter a 5-letter word and watch the entropy-maximizing algorithm solve it.

Loading word lists...

How it works

Every guess in Wordle gives you information. A guess that could produce many different color patterns is more informative than one that always gives the same result.

If a guess splits the remaining words into many small, roughly equal groups, it has high entropy. The result tells you a lot no matter what the answer is. For example, in 20 questions it is better to start with the guess "is it an animal?" rather than "is it a penguin?". The more evenly a guess can split the search space, the higher its entropy.

For each candidate guess word, the solver will simulate what color pattern you'd get against every remaining possible answer. We can then calculate the "entropy of that guess".

At each step, the solver will select the guess with the highest entropy from all the remaining possible words. The resulting coloration is then used to prune down the remaining possibilities.

For a given guess, let p(c) be the fraction of remaining words that produce color pattern c. The entropy is:

H = -Σ p(c) * log₂(p(c))

Where we evaluate the sum over all remaining words. c is the coloration resulting from our guess against that specific answer word.

There are 243 possible color patterns (3 colors × 5 positions = 3^5). A perfect guess would split the remaining words into 243 equal groups. In practice, some patterns are more likely than others, but the algorithm consistently finds guesses that narrow things down fast. On average, the first guess prunes the search space of possible remaining words down by 98%.

Most optimal starting words

We pull the set of 3102 possible five-letter words from this source. When we calculate the entropies of every starting word, we see that these are the top 5 openings by entropy:

1. tares (6.2939 bits)
2. tales (6.1977 bits)
3. rates (6.1835 bits)
4. tears (6.1672 bits)
5. reals (6.1272 bits)

Based on this, we will always choose tares as our first guess.

I have decided to implement a modified version of Wordle which is different from the original, allowing certain words to be chosen as the answer that would be banned from the NYT version :)

The "real wordle" selects answer words from a list of 2315 possibilities, while also allowing guesses from a larger set of 12972 words (which will never be the answer). If you are interested in learning more, you can take a a look at this Github gist.

Does it always win?

Running the solver algorithm on all 3102 of my possible answers, we see that it does in fact solve correctly 100% of the time!

The distribution:

  - 1 guess: 1 (just "tares" itself)
  - 2 guesses: 76 (2.4%)
  - 3 guesses: 1413 (45.5%)
  - 4 guesses: 1436 (46.3%)
  - 5 guesses: 169 (5.4%)
  - 6 guesses: 8 (0.3%)

Average is about 3.5 guesses per word.