Pigpen Cipher
Published 8 Sep 2026 · · 5 min read
Pigpen writes letters as fragments of a grid. Two tic-tac-toe frames and two X frames give exactly 26 cells, so the cipher fits the alphabet perfectly with nothing left over — which is either elegance or coincidence depending on how you feel about such things. It was the standard private hand of eighteenth-century Masonic lodges and appears carved on gravestones and marked on charts.
- Era
- Medieval
- Type
- Substitution
- Key space
- 1 key (26 glyphs)
- Level
- Starter
IPhenomenon
Draw four frames. The first two are tic-tac-toe boards; the last two are boxes with a diagonal cross. Each frame has nine cells, except the crossed ones which have four.
| Frame | Cells | Letters |
|---|---|---|
| north grid | 9 | A B C D E F G H I |
| south grid | 9 | J K L M N O P Q R |
| east cross | 4 | S T U V |
| west cross | 4 | W X Y Z |
So the letter C is the top-right cell of the north grid and the letter T is the top-right cell of the east cross. A dot inside a cell distinguishes the second family from the first, which is how the technique smuggles 26 distinct symbols out of 26 cells.
This bench writes those addresses in plain tokens — N1 is north-grid cell one, E3 is the third cell of the east cross — so you can see the mapping without drawing anything.
The important observation: the symbols are not arbitrary squiggles. They have a geometry, and geometry can be read.
IIKey space
There is no key. The glyph set is fixed and public, and has been printed in scout manuals for a century.
The apparent cleverness is that 9 + 9 + 4 + 4 = 26 exactly. That arithmetic is the entire design, and it is also the entire problem: because every letter is a shape, and shapes have neighbours.
A substitution cipher whose alphabet is printed on a poster cannot be protected by secrecy. It can only be protected by being hard to read by eye — and pigpen is not.
The dot convention is worth noting as a design pattern: it is the same trick as the Caesar shift, applied to a visual alphabet instead of a letter alphabet. When you run out of cells, add a mark.
IIIEnciphering
- Draw the four frames somewhere the receiver will also draw them, or agree on the standard layout.
- For each plaintext letter, find its cell in the frame that holds it.
- Draw the frame outline with the correct cell filled in. Use a dot for the second family (J-R and W-Z in the standard layout) if the layout requires it.
- Write the frames in a continuous line, leaving a small gap between words.
- Never write the plaintext anywhere on the same sheet of paper.
IVDeciphering
- Separate the glyph sequence into individual frames.
- For each glyph, identify which frame it belongs to by its outline shape: grid or cross, and above or below the centre line.
- Read off the cell position within that frame.
- Map the frame and cell back to the standard letter table.
- If two readings are possible because a frame was drawn ambiguously, use the surrounding words to decide — this is exactly the fragility the cipher suffers from.
VWeakness
Shape clustering. Letters that occupy neighbouring cells look almost identical on paper. N1 and N2 differ by one straight line. A single smudged pen stroke changes the letter.
Same statistics as any monoalphabetic cipher. The frequency profile survives untouched; count the glyphs and the message opens.
Failures are self-announcing. Pigpen glyphs are drawn, so they are usually written slowly and carefully — the spacing between words is often preserved, and word-boundary leaks are among the most damaging leaks there are.
It has been public for two centuries. Any attacker, anywhere, has the mapping memorised or can look it up in five minutes. There is no work factor at all.
VIPractice
Ciphertext
N3 N5 S3 S3 E1 N8 S6 S3 N4 E1 N5 N3 S9 N5 E2 E1
Hint: N = north grid, S = south grid, E = east cross, W = west cross. Cell numbers run left to right, top to bottom.
Reveal the answer
Plaintext
CELLS HOLD SECRETS
·History note
Pigpen is recorded from the early eighteenth century and is usually called the Masonic cipher or the Freemason's cipher, because it appears throughout lodge minutes, membership rolls and correspondence. It is also found on gravestones in the United States and Britain, in the margins of nautical charts, and in nineteenth-century American prison diaries. The name 'pigpen' comes from the resemblance of the tic-tac-toe frames to a pig enclosure, and it was popularised under that name by nineteenth-century puzzle books and, later, by Scouting manuals.
·Further reading
The pigpen idea keeps returning: replace the alphabet with a system of visual cells. The Baconian cipher later in this collection encodes letters as five marks; the ADFGVX field cipher encodes them as pairs of six letters. Each is the same decision — spend a little redundancy to get a symbol set that can be transmitted by whatever channel you actually have.
Pigpen was designed to be written by hand on paper. That is a channel constraint, not a security feature. Recognising which constraints are channel and which are security is most of what practical cryptography is.
Next on the loom: vigenere-tableau — the first cipher on this loom that a competent attacker actually struggles with.
+Weave into
Atbash
Atbash folds the alphabet in half and glues A to Z, B to Y, C to X. There is no key at all — knowledge of…
Nomenclator
A nomenclator is half cipher, half dictionary. It substitutes letters as usual but also assigns its own…
Baconian Cipher
Francis Bacon's 1605 biliteral cipher is the first recorded binary encoding of an alphabet, three centuries…