odds and ends from a life under construction

31 Days, Day 8: How to write in code

, / 4073 0

When people talk about “code” these days, especially in the circles I travel with, it usually has something to do with software programming. But I’m talking about the old-school kind of code – the secret kind. Ciphers! There’s something appealing about communicating in a special language, one only you and the person you’re communicating with can understand. Nerdy kid me loved to pass notes and share secrets, and it’s a fun art I’d love to brush up on and share with Evan when he’s old enough. There are more complicated ciphers out there, but for ease of explanation (and use), the three I mention below can’t be beat.

One of my favorite ciphers as a code was the tic-tac-toe cipher, known by others as the pigpen cipher, the Freemason’s cipher, or the masonic cipher. The cipher uses geometric simple substitution – replacing letters in your message with shapes – to encode phrases. First, you need your grids. You’ll have two “sets” of grids, and each set contains a tic-tac-toe board (or a hashtag, for the whippersnappers) and an “x” shape. The only difference between the two grids is the dots in the second set:


Then you add the letters of the alphabet to the grid, one letter per space. You can add the letters in any order at random if you want, but for demonstration purposes, I just went in alphabetical order:


This piece of paper has become your key. So now – we encode! Match each letter of your message to the key, and replace the letter with the grid “character”:


In addition to being fairly simple, this cipher also looks wicked cool written out. Almost like an alien language! You could add an additional grid, or vary the number of dots in each cell, to create new keys. The first character of your message could even be a symbol indicating to the receiver of your message the correct key to use. There are lots of ways to vary the tic-tac-toe cipher, but it’s also easy to learn and use so it’s great for kids.

Another common cipher is the Caesar cipher. The Caesar cipher is a simple substitution like the tic-tac-toe cipher, but instead of substituting geometric shapes you’re just using your key to replace one letter with another. The “trick” to the Caesar cipher is offsetting the alphabet by any number of letters, from 1 to 25. The order of the letters of the alphabet doesn’t change, though, so a Caesar cipher is pretty easy to crack.


The only key your recipient needs is the value of your offset – then they can create a key for themselves.

Instead of letters, you can also replace the characters in your message with numbers using a substitution cipher called the Polybius Square. Fancy-sounding name, very simple cipher. First, create a 5×5 square with numbers on the x and y axes. You can use one through five on both sides, different numbers on each side, numbers out of order… like the tic-tac-toe cipher, it’s flexible. For my “square” (looks a little lopsided since I can’t draw), I opted to keep my numbers sequential:


Now fill in the square with your alphabet in a grid. Yes, there are only 25 spaces for 26 letters; typically I and J are combined in one square since they’re rarely used in a fashion where you’d confused one with the other. If having a J in the middle of your word doesn’t make sense when you decode your message… it’s probably an I. You can place the letters out of order if you like, but having to hunt for a letter in your key can make the task of decoding less efficient:


Use your square grid to encode your message, first across and then down. So each letter will give you a two-digit number:


Voila! Three fun and simple ciphers to code your special messages. I’m thinking of sending our Christmas cards out in cipher. Everyone will think we’ve gone nuts until they get a key sometime around the new year.

And if you want to go the extra mile and make that secret code even more unreadable, here’s a bonus lesson illustrated by Yumi Sakugawa – how to make invisible ink:


Now go forth and communicate. But remember… they’re listening!

Join the Conversation