Secret codes

The pigpen cipher

Date: c. 1745Who?: The Freemasons

Letters replaced by little boxes and dots

Substitution ciphers
Illustration drawn for the site

In brief

The pigpen cipher, also called the Freemasons’ cipher, replaces each letter with a piece of a grid, with or without a dot. Used by Freemasons in the 18th century, it has become the favourite cipher of children and treasure hunts.

The story

You draw two grids shaped like a hash sign (#) and two shaped like a cross (X). The letters of the alphabet go in the boxes; in the second grid of each kind, a dot is added. Each letter is then replaced by the shape of the box around it. Masonic lodges used it in the 18th century to keep their records away from prying eyes.

The result looks mysterious, but it is a simple substitution: each symbol always stands for the same letter. Frequency analysis therefore breaks it easily. Examples are carved on gravestones, such as that of James Leeson in New York, and prisoners in the American Civil War used it.

Example

The letter A is drawn like the top-left corner of a #: an angle open to the top and left… with nothing inside.

Try it in the workshop

Did you know?

On James Leeson’s grave, in the Trinity Church cemetery in New York, an inscription in pigpen cipher carved in 1794 means “Remember death”.

Sources: D. Kahn, The Codebreakers, 1967 (rev. ed. 1996); S. Singh, The Code Book, 1999; F. L. Bauer, Decrypted Secrets, 4th ed., 2007; C. P. Bauer, Secret History: The Story of Cryptology, 2nd ed., 2021; texts written for this site.

In the same family: Substitution ciphers