Pigpen Cipher

Masonic geometric cipher — replace each letter with its grid-cell shape.

Ad placeholder (leaderboard)

The pigpen cipher — also known as the Masonic or Freemason cipher — is a geometric substitution cipher that replaces each letter with a small drawing. Instead of shifting the alphabet, it arranges the letters into grids and gives each letter the shape of the lines that surround its cell. Freemasons used it in the 1700s to keep their records private, and it remains popular in puzzles, escape rooms and children’s secret-message games.

How it works

The 26 letters are split across four grids:

  • A tic-tac-toe grid holds the first nine letters (A–I); each letter’s symbol is the corner or edge shape of its cell.
  • A second tic-tac-toe grid holds J–R using the same shapes plus a dot inside.
  • An X-shaped (saltire) grid holds S–V as the four wedges of the X.
  • A second X grid holds W–Z using the same wedges with a dot.

Because each cell has a unique combination of surrounding lines, every letter gets a distinct symbol, and the dot variants double the symbol set so all 26 letters fit. This tool renders those shapes with Unicode box-drawing characters (adding a centre dot where the scheme requires one) so the output stays as plain, copyable text. Decoding simply reverses the lookup.

Worked example

Encoding the word FREEMASON substitutes each letter for its grid symbol. The two Es produce the same symbol because pigpen is monoalphabetic — a single letter always maps to a single shape. Decoding the same string of symbols restores FREEMASON exactly, with any spaces or punctuation left untouched.

Notes and tips

Pigpen offers no real security: it is a one-to-one substitution, so repeated letters give it away and frequency analysis breaks it instantly. Treat it as a fun, visual cipher rather than a protective one. Letters are case-insensitive on encode and return as upper case on decode; spaces, digits and punctuation pass straight through. All encoding and decoding happen locally in your browser.

Ad placeholder (rectangle)