The Pigpen Cipher (What it Is and How to Teach Your Kids)

As my two boys get older, my wife and I have been able to enjoy family movie nights more and more. It’s been fun to finally expand beyond Ninjago, Pokémon, and the classic Disney movie canon (not that there’s anything wrong with any of those, but let’s be honest, there are only so many times you can watch Lego Batman). 

I’ve been working hard this past year giving my children a proper education—introducing them to some great classic movies like Indiana Jones, the Goonies, and (does this count as classic?) National Treasure. 

As I’m watching these movies, I can’t help but remember how much I wanted to go on my own treasure adventure when I was a kid. It got me thinking. How can I find a way to give my kids a fun adventure in a classic Dad Stuff way? An adventure that inspires my kids, gets their imaginations running, and is fun for me too. 

My epic deep dive has led me down some rabbit holes, one of them leading me to the pigpen cipher. 

What is a Pigpen Cipher (Masons’ Cipher, Tic-Tac-Toe Cipher)?

The pigpen cipher is a simple substitution cipher in which letters of an original message (plaintext) are substituted by geometric symbols creating a coded message (ciphertext). 

The pigpen cipher gets its name because letters of the alphabet are separated like pigs in a pen using checkerboard and X patterns. Fragments of the checkerboard and X patterns then replace the letters of the original message. 

If you want to try another cipher that’s simpler for younger kids, check out The Scytale Cipher (What It Is and How to Teach Your Kids).

History of the Pigpen Cipher

The pigpen cipher has a long history. Some historians argue the Knights Templar used the pigpen cipher during the Crusades almost a century ago. 

Freemasons used the pigpen cipher so often some call it the Freemasons’ cipher. Some earlier members even claimed the Freemasons invented the pigpen cipher. To this day, engravings of the pigpen cipher can be found on the tombstones of some Freemasons. 

Freemason Symbol
Freemason Symbol

George Washington’s army had used a more randomized version of the pigpen cipher. There is evidence that suggests Union prisoners in Confederate prisons used the pigpen cipher during the American Civil War.

The pigpen cipher is a simple monoalphabetic substitution cipher, in that one letter is replaced by one symbol, so it can be quite easy to break. While professional cryptographers don’t use it today, it’s a fun cipher to do with your kids. Especially because it looks like something created by an alien.

If you want to learn about another cipher used in history, check out The Ottendorf Cipher (What it Is and How to Teach Your Kids).

How to Encode and Decode Messages Using a Pigpen Cipher

To understand how a pigpen cipher works, begin by drawing two tic-tac-toe and X grids. Place dots inside the second tic-tac-toe and X grids like in the figure below. 

Next fill in the grids with the letters of the alphabet.

The figure above is a classic arrangement of the pigpen cipher. If you want to have greater security using this cipher, place the letters of the alphabet in an arrangement known only to you and the message receiver.

To encode (that is to convert the plaintext message into ciphertext), replace letters of the original message (plaintext) with the corresponding fragment of the grid associated with the letter (ciphertext)

Using the pigpen cipher, we can encode the following message:

“It takes guts to be an organ donor”

To decode, simply work the other way. Take the symbols of your coded message and replace them with the corresponding letters. 

Pro tip: you can download and install a pigpen cipher font. Simply type your message in a standard font, then convert it to a pigpen font, print it out, and Bob’s your uncle. 

If you want another great easy secret code for your kids, check out The Caesar Cipher (What it Is and How to Teach Your Kids).

Pigpen Cipher Activity Ideas (Plus a Free Worksheet)

The great thing about the pigpen cipher is that it’s super easy to learn and kids think it looks cool. There’s something about it that makes it look like it’s a message from an alien. When I first showed it to my oldest son, he fell in love with it, and showed all his friends. He then spent hours “discovering” secret messages aliens left in his room. 

Take the time to show your kids how this cipher works. Use a simple printout or draw the code on a piece of paper. It really is that easy. 

You can reinforce this by giving them a couple worksheets to do. You can download a free pdf worksheet below (and I do mean free. Not the “it’s free but I need your personal information first” kind of free) with an explanation and a couple of activities for your kids. 

Learn more: 6 Secret Codes and Ciphers to Teach Young Kids

But if you’re new to Dad Stuff, you should know that I like to be a bit extra. This is especially true when it comes to activities with my kids. 

If you want to up your game, place a message from an alien where you kid can discover it. I used a piece of pvc pipe with end caps on it. Then I painted it gray and painted my kids’ names on it encoded using the pigpen cipher.

Pigpen Penpals Space Messaging Tube
Pigpen Penpals Space Messaging Tube

Leave a coded message saying you’re Zargon from the Planet Mok and you heard about the earth from Spaceman Spiff and that you would like to become pen pals (check out my article here to see how I did this with my own kids)

If you’re more ambitious, strategically leave an alien artifact with clues that lead to an epic alien treasure hunt.

Especially because of its roots with the Freemasons, you can do a National Treasure-themed hunt or escape room (stay tuned for details on this one in the future!). 

Whatever you decide to do, use your imagination and involve your kids. I love finding ways to create treasure hunts for my kids. They have a fun time, I have a blast watching their imaginations run wild, and at the end of the day, they’re mentally spent. Those nights are some of the easiest bedtimes!

You might also like these Treasure Hunt activities:

Gregory Grabowski

Greg Grabowski is the principal creator of, a website for dads by dads. Inspired by his two boys Ben and Sam and his wife Dianna, Greg loves to make things, learn things, and loves doing fun stuff with his family.

Related Posts