It’s fall again, and knitting is back, baby. Technically, you can knit year-round, but there’s something about curling up on the couch with a fluffy ball of yarn and a hot cup of cocoa that just screams comfort. Not to mention that you get to flaunt a cozy garment at the end of the process.

Even though knitting is cool as it is—don’t let anybody tell you otherwise—it’s even more awesome if you add some mystery. Give that sweater or scarf a little something extra by encoding a secret message into it. It can be as simple or as intricate as you like, and you can give someone a key to decode your message or let them wear a beanie without knowing the true meaning behind its pattern.

Give your crush a scarf confessing your love for them, or tell that obnoxious uncle of yours how you truly feel with a pair of comfy socks. The possibilities are endless, and you’ll get to be part of a long tradition of undercover operatives who used knitting as a tool for espionage.

007? More like double-purl 7.

If you’ve ever read A Tale of Two Cities, you might remember Madame Defarge, who enjoyed watching noble men and women beheaded while knitting the encoded names of the ones who would meet the guillotine next. But this practice is not only fiction.

During World War I and World War II, ordinary women all over Europe were recruited as spies for both sides. As knitting was common at the time, a woman at a window with a pair of needles and a ball of yarn was inconspicuous. They observed the comings and goings of soldiers and other important strategists, and since knitting’s binary stitch system translates easily into code, they could secretly embed information into their projects.

During WWI, in German-occupied Belgium, women collected data about trains, translating the frequency of their passing into holes in sweaters. These messages would end up in the hands of the local resistance, aiding their fight against occupying forces. On the other side, German agents based in the UK gathered intelligence and encoded it into yarn using knots, following a system similar to Morse code. They’d knit the yarn into a garment, which German authorities would later unravel to decipher the secret information.

Espionage these days seems to mostly happen online, but analog methods should never be underestimated. Even if the data you’re encoding is not a matter of national security, it could be a fun way to literally wear a secret up your sleeve.

Choose your message

There are hundreds of ways you can turn a word, number, or phrase into a knitting pattern. If you want to go all-out, you can get really creative.

The easiest way to do it, though, is to put numbers into a grid and use it as a knitting pattern. What kind of grid you use, however, will depend on how hard you want to make it for someone to decode your message—that is if you even want to make it readable. We decided to make it easy, but if you build on this and come up with your own method, the sky’s the limit.

First, choose your message. If you want to embed a date—your anniversary, a birthday, a graduation day—make sure you turn the day, month, and year into two-digit numbers. This means a date such as May 22, 2018, could be translated into 052218. Keeping them all the same length will make it easier to decipher if you choose to do so later.

If you want to embed a phrase, we suggest using as few words as possible, as each letter of every word will turn into a two-digit number. For example, a sentence like “I love DIY” (eight letters), would turn into 16 consecutive digits. The easiest way to make this conversion is to assign a number to each of the 26 letters of the alphabet, where “A” is 01 and “Z” is 26. Following that system, “I love DIY” would translate into 0912152205040925.

You can decide what to do with spaces—you can ignore them completely, or assign them a digit combination or another type of pattern you won’t mistake for a letter.

Turn your message into a grid

If you want to make your message as hard to crack as possible, you can play around with your grid’s level of intricacy. Again—the sky’s the limit.

If you want to keep things simple, you can go with a grid where your X-axis—representing the amount of stitches—has 10 numbers (one for each digit), while your Y-axis—representing the amount of rows—has as many numbers as your encoded message. In this case, our grid goes horizontally from 0 to 9, and vertically from 1 to 18.

In the grid below, each box is a stitch, and every red box is an odd stitch—a purl, a different color, or a hole. To encode the message, you must use the X-axis to identify the correct digit, and mark the box for it in the corresponding row in the Y-axis. For example, the letter “I” in “I love DIY” is 09, and because 0 and 9 are the first two digits in our sequence, they are in the first and second rows, respectively.

Knitting patterns
On the left, the pattern for our “I love DIY” message. On the right, the pattern repeated twice. Sandra Gutierrez

Notice how we added two extra rows in our grid—they’re for the spaces between the words, shown in the grid by two consecutive odd stitches. If you want to make it more obvious (as in the image below), you can mark a space by leaving a row blank (top), filling it (center), or alternating stitches (bottom).

Knitting pattern
You can do whatever you want to spaces between the words in your message. Even ignore them. Sandra Gutierrez

If you use this kind of grid, your pattern will always be 10 stitches wide. This would be thin enough to knit a scarf in 2002, but since we’re fortunately over that horrendous trend, you might want to repeat your pattern to the side as many times as necessary.

Get your knitting on

Knitting coding project
Alternating purl and knit stitches is the easiest way to embed your project with a secret message, and it’s harder to see from a distance. Sandra Gutierrez G.

Once you have your pattern, the way you interpret it depends on what you can and want to do. Knitting is a binary language, and even the most intricate designs are mostly composed of two simple elements—a knit stitch (which looks like a flat V) and a purl stitch (which looks like a bumpy wave).

The easiest way to bring your pattern to life is to indicate a digit within your pattern by means of an odd stitch (a purl), in a row of plain knit stitches. That way, you’ll only have one purl stitch per row, or as many as times you’re repeating your pattern (in our example, we’re repeating it twice).

If you think alternating between purl and knit stitches is too easy, you can use holes as a marker for each digit. Just remember that every time you knit two stitches together to make a visible space in your knitting, you’ll need to add another so that the total number of stitches per row remains the same throughout your project.

For more advanced knitters who are not afraid of the challenge of handling two yarns at once, you can also use a second color and turn your message into a jacquard pattern. This will make your message easier to read, and it’s a great alternative if you think holes or the purl/knit combo will look more like the first project of a noob knitter than a hidden message.

Wear it, gift it, flaunt it

You can embed secret messages into any kind of project, be that a simple beanie, a scarf, a sweater, or a blanket. The length of your message or the level of intricacy you use to encode it will depend entirely on you. But even in the simplest of ways, a handmade knitted piece with an embedded personal message can make a great gift—or the greatest espionage tool that ever was.