Here’s how to win at Wordle, every time

Laurent Lessard, associate professor in the department of mechanical and industrial engineering, solved Wordle algorithmically. Photo by Matthew Modoono/Northeastern University

What’s your go-to first guess in Wordle? Yours truly uses “adieu,” for all its vowels. But there’s a better choice: If you’re playing in hard mode, and want to win in five guesses or fewer, choose “scamp.”

That little rascal sets off the first tumbler in a cascading series of algorithms that will unlock Wordle every time, guaranteed, says Laurent Lessard, an associate professor of mechanical and industrial engineering at Northeastern and core faculty in the university’s new Institute for Experiential AI. He would know. He built them.

“When I see puzzles like Wordle, the immediate thing that jumps to my mind is: What’s the best way to play and win?” Lessard says. “What does it mean to have the best strategy?”

Laurent Lessard, associate professor in the department of mechanical and industrial engineering, solved Wordle algorithmically. Photo by Matthew Modoono/Northeastern University

Lessard, who in his day job does research in control theory and optimization, moonlights as something of a puzzle detective. He’s been solving FiveThirtyEight’s weekly Riddlers for months, and posting elegant explanations to his blog, Book Proofs, where they’ve gained a cult following (and a few shout-outs from Zach Wissner-Gross, who edits the Riddler column for the data-focused news outlet).

Then, at the start of 2022, a new puzzle swept the world. As omicron peaked, millions of people huddled over their computer and phone screens, trying each day to guess a five-letter word in six attempts or fewer. Wordle was everywhere, even before the New York Times bought it for seven figures. Just as quickly, guides that purported to offer the best way to win the word game proliferated. CNN even got in on it.

But, Lessard says, the question is too broad, because there are any number of ways to define the “best” way to win, each with their own costs and benefits.

You could play to minimize the number of guesses it takes to find the right answer, but that requires taking big risks at the beginning. A two-guess victory is impressive, and sometimes those risks pay off. But other times you’ll end up needing seven or eight guesses to figure out the answer, and that means losing.

Or, you could look for a strategy that would guarantee you’ll find the right word in fewer than six attempts. That might mean playing it a bit safer in the beginning—no flashy two-guess Twitter spreads in this strategy—but you know you’ll always find the mystery word before your chances run out.

Laurent Lessard devised a series of winning strategies that are based on three different ways to define the ‘best way’ to win. Photo by Matthew Modoono/Northeastern University

Around the same time that people were sharing their homegrown strategies online (start with “later” or eliminate vowels as quickly as possible) the Riddler posed a puzzle that narrowed down the inquiry: Devise a strategy to maximize your probability of winning Wordle in at most three guesses.

That was something Lessard could work with, and indeed already had. Using Wordle’s publicly available source code, Lessard pulled the game’s two word dictionaries. One includes 2,315 mystery words, or all the possible solutions to the game. The other includes all 12,972 words you’re allowed to guess, most of which are so obscure or arcane that they’ll never be the mystery word. He used these lists as the foundation of his strategies.

To understand what Lessard did next, you first have to understand how Wordle works. As mentioned, players have six chances to guess a five-letter word that changes every day. After each guess—which constitutes one line in a six-tier puzzle—Wordle returns a series of color-coded hints to the player. Letters that appear in gray boxes (Black square) are not in the mystery word. Letters that appear in yellow boxes (Yellow square) are in the mystery word, but they’re in the wrong location in the player’s guess. And letters that appear in green boxes (Green square) are in the mystery word and in the correct location.

Players can also toggle between regular mode or hard mode. In regular mode, each guess can be unique and they don’t need to relate to each other. In hard mode, they do. If you discover from your first guess that there is a “u” in the mystery word, your next guess must contain a “u.”

Taking all this into account, Lessard devised a series of winning strategies that are based on three different ways to define the “best way” to win. The mechanisms behind these strategies contain some serious math, which Lessard explains in depth on the open-source platform GitHub and in a more digestible format in a recent blog post.

Lessard was joined in his effort by a few friends including Vincent Tjeng, a software engineer at Google who spotted Lessard’s work online, and Evan Sparks, vice president in AI and High Performance Computing at Hewlett Packard Enterprise.

One strategy, however, stands out: A complete turn-by-turn strategy guaranteed to win hard mode in 5 moves or fewer.

Fans of the game, proceed at your own risk.

Their work utilizes an algorithm that integrates the feedback from Wordle in hard mode. So, after each guess, the computer narrows down the list of possible solutions based on the letters that are known to be in the word, and the ones that are known not to be.

Lessard and Tjeng found that the only way to guarantee a win in five moves of fewer in hard mode is to start with “scamp” or “scowl”. Let’s say you use “scamp” as your first guess, and Wordle returns green, gray, gray, gray, gray (Green square Black square Black square Black square Black square). Now the computer (and you) know that the mystery word begins with an “s” and does not contain the letters c, a, m, or p. This narrows down the list of possible options from 2,315 to 138.

The best word to pick next is “stern”, because it matches what we know about the mystery word, and contains the most commonly used letters among the options remaining. Now suppose Wordle returns green, gray, yellow, green, gray (Green square Black square Yellow square Green square Black square). This narrows down the possible solutions from 138 down to just three: “shire”, “swore”, and “shore”. The next guess is “shire”, and the ensuing response would pinpoint the mystery word with certainty.

This is just one possible path. Lessard and Tjeng spelled out every move, based on any result, in a post online. They also showed, through a brute-force computational search, that there is no strategy (even in regular mode) that guarantees a win in four moves or fewer. So five is really the best you can do!

For the hardcore wordsmith, such a blueprint may seem anathema to the spirit of the game. But where some see a word puzzle, Lessard saw a math puzzle—a question of probabilities and statistics that could be solved by unlocking just the right set of equations. He collaborated with friends who bounced ideas off each other and posted their progress online. People who play the word game pick each other’s brains for possible words and post their solution grids on Twitter.

In the end, is it really so different?

For media inquiries, please contact Shannon Nargi at s.nargi@northeastern.edu or 617-373-5718.