What is Pigpen Cipher (with Example)

Pigpen cipher is a simple substitution cipher that works by replacing each letter of the message with a symbol. In pigpen cipher, each letter is assigned to a symbol based on where the letter is located. For example, A is inside a backward L, N is inside a box with a dot near the bottom, and T is in a V turned on its side.

pigpen cipher grid

It goes with other names like (masonic cipher, Napoleon cipher, and tic-tac-toe cipher).

A brief history of this encryption scheme:

The origin of this cipher is not known or whoever invented it but it has been used for a long time.

Here are the groups of people that used this cipher:

  • Freemasons, the secret society in the 18th Century.
  • Union prisoners in Confederate camps during American Civil War.

Basically, this encryption uses symbols to share messages. The bizarre shapes are secret codes for transmitting information without getting detected easily.

Pigpen code is the most popular secret writing alphabet in history.

Here are the six most popular uses of pigpen code:

  • Encrypted gravestone inscriptions.
  • Encrypted certificates.
  • Encrypted testaments.
  • Mug inscriptions.
  • Beer labels.
  • Encrypted treasure maps.

Are you interested in finding out more about ciphers and codes?

The Codebreakers – The Story of Secret Writing book by David Kahn is what I would start with.

Pigpen Cipher Example

Generally, with this cipher you turn each letter of your message into its symbol equivalent based on this grid:

pigpen cipher grid

All you have do is replace each occurrence of a letter with a given symbol.

Encryption example:

Plaintext: Who do you think invented pigpen cipher.

Am going to use the grid above to form the symbols associated with each letter in my message to encrypt it.


pigpen solution

How to decrypt a message

Decoding is equally simple, you need to locate the symbol depicted in the ciphertext and replace it with the letter given in the grid above.

Try out the following example to enhance your understanding of pigpen cipher:

Plaintext: Pigpen is the best symbol substitution cipher.

Ciphertext: ?

If you need more help there are a few online tools that will help you learn more about this cipher

Here is a pigpen cipher online JavaScript example, a real-time Pigpen cipher generator you can play with to learn how this encryption scheme works.

Are you interested in learning how to break codes?

The Elementary Cryptanalysis – A Mathematical Approach book by Abraham Sinkov is what I would recommend.

Various pigpen cipher variants

Here are the three most common variants:

a) Changing the order from grid, grid, X, X to a grid, X, grid, X:

pigpen variant 1

b) Placing the letters alternatively the dot and non-dot parts to split adjacent letters:

pigpen variant 2

c) Using three grids, and using either a full stop or space o occupy the last position:

pigpen variant 3

As you can see the pigpen code is about making a kind of alternative alphabet and making messages by translating words through it.

Since pigpen is an also a monoalphabetic substitution cipher, it’s very prone to cryptanalysis and breaking it is extremely easy.

Due to its simplicity, this encryption has been included in several children’s books that talk about ciphers and other secret codes writing.

How to recognize PigPen ciphertext

The encoded message is made from symbols with right angles which some time has a dot (1 symbol out of 2 has a dot).

The message has a maximum of 26 distinct characters.

What are the variants of the Freemason’s PigPen cipher

There are multiple variants that associate symbols and letters. Most popular variants have been proposed in the video game Assassin’s Creed.

Also. The Knight Templars cipher is very similar and has symbols very close.

Why this cipher is named Pig Pen

Symbols can be assimilated into pens and dots could be interpreted as small pigs.


Please enter your comment!
Please enter your name here