How to use the pigpen cipher
- Type or paste your plaintext message into the Text to encode field.
- Choose a White or Transparent background for the output image.
- Click Generate to draw the pigpen cipher glyphs as an SVG.
- Review the letter mapping table below the image to verify each symbol.
- Save or copy the SVG to share your encoded message.
How the Pigpen Cipher Works
The pigpen cipher, also called the freemason cipher or masonic cipher, is a geometric substitution system. Instead of swapping one letter for another like the caesar cipher translator does, it replaces each letter with a fragment of a grid.
There is no single official key. This tool uses the common Freemason convention, in which the alphabet is split across four shapes:
- A tic-tac-toe grid holds A through I, reading left to right, top to bottom. The glyph is the walls of the cell that contains the letter, so A is drawn as the right and bottom walls of the top-left cell and I as the top and left walls of the bottom-right cell.
- A second tic-tac-toe grid with a dot in every cell holds J through R.
- An X shape holds S through V in its four wedges: S top, T left, U right, V bottom.
- A second X shape with dots holds W through Z in the same order.
Variants exist, and some sources place the wedges of the X in a different order, so a message written with another key may not decode with this table. The layout here is the widely used one, but it is a convention rather than a documented standard.
To encode the word "HELLO": H is the bottom-middle cell of the first grid, drawn as its top, left and right walls; E is the centre cell, a full square; L is the top-right cell of the dotted grid, drawn as its left and bottom walls plus a dot; and O is the middle-right cell of the dotted grid, drawn as its top, left and bottom walls plus a dot.
Letter Mapping Reference
Use this table to read or write pigpen cipher symbols by hand. Each letter maps to one cell of a grid or one wedge of an X. The full 26-letter table is also shown under the generated image.
| Grid | Letters | Shape description |
|---|---|---|
| Tic-tac-toe (no dot) | A B C / D E F / G H I | The walls of each cell, such as right and bottom for A |
| Tic-tac-toe (with dot) | J K L / M N O / P Q R | Same walls plus a dot in the cell |
| X shape (no dot) | S (top), T (left), U (right), V (bottom) | V, >, < and ^ shaped wedges of the X |
| X shape (with dot) | W (top), X (left), Y (right), Z (bottom) | Same wedges plus a dot inside the wedge |
Because the shapes are purely visual, someone looking for a keyword shift like those used in the vigenere cipher will find no alphabetical pattern here.
Historical Use of the Masonic Cipher
The cipher is commonly associated with Freemasonry, and similar grid-based symbol alphabets are reported in records from the eighteenth century, but the details of who used which key and when are not well documented, so treat any precise history with caution. The geometric symbols look like simple doodles rather than writing, which is the appeal.
It is also reported to have been used by Union prisoners during the American Civil War. Unlike mathematical ciphers such as the affine cipher, the pigpen system requires no arithmetic, making it accessible to anyone who memorizes four grids.
Today it appears in puzzles, geocaching clues, escape rooms, and educational materials about cryptography basics.
Decoding Pigpen Messages
This tool encodes plaintext into SVG glyphs. To decode a pigpen cipher message, you reverse the process: look at each drawn shape, identify which of the four grids it belongs to, determine whether a dot is present, and find the letter occupying that cell or wedge.
For automated decoding of other substitution systems, you might explore a general cipher decoder. However, because pigpen symbols are images rather than characters, optical recognition or manual lookup against the reference table above is required.
Spaces between words are typically preserved as gaps between glyphs. Numbers and punctuation have no standard pigpen representation, so they are usually written out or omitted.
Common Mistakes and Edge Cases
When drawing the pigpen cipher by hand, several errors frequently occur:
- Mirroring shapes: The open side of a corner must face the correct direction. A corner for the top-left cell (A) is not the same as the corner for the bottom-right cell (I).
- Forgetting dots: Without the dot, J through R collapse back into A through I, changing the entire message.
- Confusing X wedges: The four triangles in the X grid must be assigned consistently. Top is S (or W), left is T (or X), right is U (or Y), bottom is V (or Z).
- Non-alphabetic characters: Only A through Z have defined glyphs. Numbers, spaces, and punctuation need separate handling or omission.
This encoder normalizes input to uppercase, turns spaces into gaps and skips other unsupported characters, so only valid glyphs are produced.
Worked examples
| Example | Input | Result |
|---|---|---|
| Hello | Text to encode: HELLO; Background: white | Letters encoded: 5; H: Grid 1, bottom-middle cell: top, left and right, no dot; E: Grid 1, centre cell: all four, no dot; L: Grid 2 (dotted), top-right cell: left and bottom, with a dot; O: Grid 2 (dotted), middle-right cell: top, left and bottom, with a dot |
| Freemason | Text to encode: FREEMASON; Background: white | Letters encoded: 9; F: Grid 1, middle-right cell: top, left and bottom, no dot; R: Grid 2 (dotted), bottom-right cell: top and left, with a dot; E: Grid 1, centre cell: all four, no dot; M: Grid 2 (dotted), middle-left cell: top, right and bottom, with a dot; A: Grid 1, top-left cell: right and bottom, no dot; S: X 1, top wedge: V shape, no dot; O: Grid 2 (dotted), middle-right cell: top, left and bottom, with a dot; N: Grid 2 (dotted), centre cell: all four, with a dot |
| Secret message | Text to encode: SECRET; Background: transparent | Letters encoded: 6; S: X 1, top wedge: V shape, no dot; E: Grid 1, centre cell: all four, no dot; C: Grid 1, top-right cell: left and bottom, no dot; R: Grid 2 (dotted), bottom-right cell: top and left, with a dot; T: X 1, left wedge: > shape, no dot |
| Full alphabet | Text to encode: ABCDEFGHIJKLMNOPQRSTUVWXYZ; Background: white | Letters encoded: 26; A: Grid 1, top-left cell: right and bottom, no dot; B: Grid 1, top-middle cell: left, right and bottom, no dot; C: Grid 1, top-right cell: left and bottom, no dot; D: Grid 1, middle-left cell: top, right and bottom, no dot; E: Grid 1, centre cell: all four, no dot; F: Grid 1, middle-right cell: top, left and bottom, no dot; G: Grid 1, bottom-left cell: top and right, no dot; H: Grid 1, bottom-middle cell: top, left and right, no dot; I: Grid 1, bottom-right cell: top and left, no dot; J: Grid 2 (dotted), top-left cell: right and bottom, with a dot; K: Grid 2 (dotted), top-middle cell: left, right and bottom, with a dot; L: Grid 2 (dotted), top-right cell: left and bottom, with a dot; M: Grid 2 (dotted), middle-left cell: top, right and bottom, with a dot; N: Grid 2 (dotted), centre cell: all four, with a dot; O: Grid 2 (dotted), middle-right cell: top, left and bottom, with a dot; P: Grid 2 (dotted), bottom-left cell: top and right, with a dot; Q: Grid 2 (dotted), bottom-middle cell: top, left and right, with a dot; R: Grid 2 (dotted), bottom-right cell: top and left, with a dot; S: X 1, top wedge: V shape, no dot; T: X 1, left wedge: > shape, no dot; U: X 1, right wedge: < shape, no dot; V: X 1, bottom wedge: ^ shape, no dot; W: X 2 (dotted), top wedge: V shape, with a dot; X: X 2 (dotted), left wedge: > shape, with a dot; Y: X 2 (dotted), right wedge: < shape, with a dot; Z: X 2 (dotted), bottom wedge: ^ shape, with a dot |
FAQ
What is the pigpen cipher?
The pigpen cipher is a geometric substitution system where each letter of the alphabet is replaced by a symbol made from grid lines and optional dots. It is also known as the freemason cipher or masonic cipher. This tool follows the common Freemason key, one of several variants.
Can this tool decode pigpen cipher messages?
No, this tool only encodes text into SVG glyphs. Decoding requires visually matching each drawn symbol back to the letter mapping table provided on this page.
Is the pigpen cipher secure?
No. It is a simple monoalphabetic substitution, just drawn differently. Anyone familiar with the four grids can read it instantly. For real security, modern algorithms or at least keyed ciphers like the playfair cipher are needed.
Why is it called the freemason cipher?
It is associated with Freemasonry, which is said to have used similar grid-based symbols to keep private records from outsiders, hence the names freemason cipher and masonic cipher. The exact history is not well documented.
Do numbers have pigpen symbols?
The standard pigpen cipher only defines symbols for the 26 letters of the Latin alphabet. Numbers are typically spelled out as words or written in plain digits alongside the glyphs.
Does my text leave my computer when I use this tool?
No. The encoding logic and SVG generation run entirely in your browser. Nothing is sent to any server.