Skip to main content

The Pigpen Cipher: How a Tic-Tac-Toe Grid Turns Letters Into Secret Symbols

A plain guide to the pigpen cipher: how letters map to grid fragments, its Freemason history, why it is easy to crack, and how to use it for puzzles.

Published By Li Lei
#pigpen cipher #masonic cipher #classical ciphers #puzzles #cryptography

The Pigpen Cipher: How a Tic-Tac-Toe Grid Turns Letters Into Secret Symbols

The first time I saw the pigpen cipher I thought someone had spilled a box of tiny gates and corners across a page. There were no letters, no numbers, just little angles, a few with dots tucked inside them. It looks alien until you learn the one trick behind it, and then the whole thing collapses into something a child can draw. That is the charm of the pigpen, also called the Masonic or Freemason cipher: the secret is a picture of a grid, and once you see the grid you can never unsee it.

The Two Scaffolds That Hold Every Letter

The pigpen cipher is built on exactly two shapes. The first is a tic-tac-toe grid, three rows by three columns, nine cells. The second is a large X, which gives you four wedges pointing up, down, left and right. That is the entire skeleton, and all 26 letters of the alphabet hang off it.

You split the alphabet into four runs and lay each one onto the scaffolds. A through I fill the nine cells of a plain grid. J through R repeat those same nine cells, but every symbol now carries a dot inside it. S through V take the four wedges of the plain X. W through Z repeat the X wedges, again with a dot added. So the dot is not decoration; it is information. It tells you whether a letter belongs to the first pass over a shape or the second.

Here is the concrete part that makes it click. The symbol for a letter is simply the lines that border the cell it sits in. Nothing more. If you put A, B, C across the top row of the grid, D, E, F in the middle, and G, H, I along the bottom, then the letter A occupies the top-left cell. The lines that wall off that corner from inside the grid are the right edge and the bottom edge, so A draws as a corner that opens toward the bottom-right, like an L turned around. The center cell, E, is boxed on all four sides, so it draws as a full square. The pigpen is not a code you memorize letter by letter; it is a map you read off the grid.

Why A and J Are Twins

This is the part beginners trip over, and it is worth slowing down for. Because the second group reuses the first group's cells, A and J share the identical corner shape. The only difference is that J carries a single dot in the middle and A does not. The same relationship holds across the board: B and K are the same shape apart from the dot, S and W are the same X wedge apart from the dot, and so on.

Forgetting the dot, or sprinkling an extra one by accident, quietly rewrites your message. A becomes J. W becomes S. The structure does not complain; it just hands you the wrong letter. If you decode something and it comes out one letter off in a few spots, the dot is almost always the culprit. The fix is to check the symbol against a full reference chart, which is exactly why the pigpen cipher tool keeps an A-to-Z chart on the page.

A Worked Example: Spelling PIGPEN

Let me trace one short word so the shapes feel real rather than theoretical. Take the word PIGPEN.

  • P sits in the dotted-grid group (J through R), in the bottom-center cell, so it draws as a three-sided pen with a dot inside.
  • I is the last cell of the plain grid, bottom-right, drawn as a corner opening to the top-left.
  • G is the bottom-left cell of the plain grid, a corner opening to the top-right.
  • P again, the same dotted bottom-center pen.
  • E is the center of the plain grid, a complete square with no dot.
  • N is the center of the dotted grid, a complete square with a single dot.

Six symbols, no two identical except the repeated P, and not a single recognizable letter among them. To a stranger it reads as gibberish geometry. To anyone holding the grid in their head, it spells PIGPEN as plainly as if you had typed it. Because there is no Unicode character for these shapes, a tool can also hand you a stable text key for each glyph, such as g-tl for the top-left grid cell, so the puzzle can travel as ordinary copyable text and still decode back into symbols.

A Cipher With a Lodge and a Battlefield Behind It

The pigpen has a real history, not just a hobbyist one. It shows up in documents from at least the early 1700s and is bound tightly to Freemasonry, which is why "Masonic cipher" and "Freemason cipher" are the same thing. Lodges used it to keep records and private correspondence away from casual eyes. The symbols were quick to draw with a quill and easy to teach to a new member.

It did not stay in the lodge. During the American Civil War, Union soldiers reportedly used pigpen to pass field notes, and there are accounts of Confederate prisoners scratching pigpen messages on prison walls. The appeal was the same in a candlelit lodge and a wartime cell: you can write it by hand, fast, with no special equipment, and a reader who knows the grid decodes it on sight.

Why It Is So Easy to Crack

Here is the honest limitation. The pigpen is a simple monoalphabetic substitution cipher, meaning each letter is always swapped for the same single symbol, every time, with no key and no variation. That property is exactly what makes it readable and friendly, and it is also exactly what makes it weak.

Because the mapping never changes, every weakness of substitution ciphers applies. Frequency analysis breaks it without mercy: in English the symbol standing in for E will appear far more often than any other, so a code-breaker can guess E from sheer count, then T, A, O, and pry the rest open from there. Even without counting, the geometry leaks the secret. The moment someone recognizes the corners and X wedges as pieces of a grid, the whole "encryption" evaporates. There is no key to guess and nothing to brute-force, so it offers essentially zero protection. Treat it as a puzzle and a teaching aid, never as real security; for anything that must stay private, a fixed-alphabet trick like this, or its cousins the Atbash cipher and the Caesar cipher, should never be in the conversation.

Where the Pigpen Actually Shines

Stripped of any pretense of secrecy, the pigpen becomes a great toy. It is a staple of escape rooms, geocaching logs, scout activities, treasure-hunt books and capture-the-flag puzzles, precisely because a player can crack it by hand with nothing but a grid sketched on scrap paper. No key card, no number to look up, no app required to read it.

That low barrier is what makes it a wonderful first lesson in cryptography. Students draw the symbol rather than compute it, so the idea of "substitution" stops being abstract and becomes something on the page. Show a class that A is the top-left corner and J is that same corner with a dot, let them encode their own names, then have them swap and decode a neighbor's. You can encode the location of a hidden clue, print the strip of glyphs on a card, and let solvers read it letter by letter. Whether you are building a room, teaching a club, or just leaving a fun note for someone who knows the grid, the pigpen cipher does one job beautifully: it makes a message look mysterious while staying delightfully easy to share.


Made by Toolora · Updated 2026-06-13