T

Text Machine

Powerful text tools, in your browser

Pigpen Cipher

Translate text to and from the pigpen cipher — the Masonic or Freemason cipher — that replaces each letter with a symbol drawn from two tic-tac-toe grids and two X shapes. Type to watch your message turn into symbols, click symbols to decode a message back into letters, follow along on the live A–Z chart, and download the result as an image. Everything runs in your browser.

Plain text
Pigpen symbols

Type text above to see it written in pigpen symbols.

Pigpen alphabet

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

How to use Pigpen Cipher

  1. 1

    Choose encode or decode

    Pick Encode to turn plain text into pigpen symbols, or Decode to turn symbols you have seen back into letters.

  2. 2

    Type your message to encode

    In Encode mode, type or paste your text. Each letter becomes a pigpen symbol instantly, while spaces and punctuation are kept as they are.

  3. 3

    Click symbols to decode

    In Decode mode, use the on-screen symbol keyboard to click the shapes you see, in order. Use Space between words and Backspace to fix a slip.

  4. 4

    Use the alphabet chart

    Open the pigpen alphabet chart to see every letter and its symbol. It is the exact key this tool uses, so you can check or copy any shape.

  5. 5

    Save, copy, or share

    Download your encoded message as an SVG image, copy the decoded text, or share a link that reopens the tool with your exact message ready to go.

Understanding the Pigpen Cipher

What is the pigpen cipher?

The pigpen cipher is a simple substitution cipher that swaps each letter of the alphabet for a little geometric symbol instead of another letter. Because those symbols are built from the lines of two grids and two crosses, an encoded message looks like a row of angular shapes rather than text — which is a large part of its charm. It goes by many names: the Masonic cipher, the Freemason's cipher, the Napoleon cipher, the tic-tac-toe cipher, and the Rosicrucian cipher, all describing the same idea.

It is one of the most recognisable ciphers in the world and a favourite first cipher for children, puzzle makers, escape rooms, and capture-the-flag challenges, because the symbols are easy to draw by hand and fun to decode. This tool turns text into pigpen symbols as you type, lets you decode a message by clicking the symbols you see, and shows the full alphabet chart so you can learn the system at a glance.

How the pigpen cipher works

Start by writing the alphabet into four diagrams: two tic-tac-toe grids and two X shapes. The first grid holds A, B, C, D, E, F, G, H, I; the second grid holds J, K, L, M, N, O, P, Q, R; the first X holds S, T, U, V; and the second X holds W, X, Y, Z. Each letter's symbol is simply the lines that surround its position in the diagram. A letter in a grid cell is drawn as the lines that box that cell in, and a letter in an X is drawn as the wedge of the cross that points to its position.

To tell the two grids and the two X shapes apart, the second grid and the second X add a dot inside each symbol. So a plain three-sided shape and the same shape with a dot are two different letters. The letter E, for example, sits in the centre of the first grid surrounded on all four sides, so its symbol is a complete square; N sits in the centre of the second grid, so its symbol is that same square with a dot — the dotted twin of E.

The grids, the X shapes, and the dots

Reading the symbols becomes easy once you see the pattern. In each grid, a corner cell keeps only two of its lines, an edge cell keeps three, and the very centre keeps all four to make a closed box. B, in the top-middle cell, is open at the top and closed on the other three sides, giving a U shape; A, in the top-left corner, keeps just the line on its right and the line below it, giving a right-angle corner. Every grid letter is one of these open or closed boxes.

The last eight letters live in the two X shapes. Picture a cross with four triangular wedges — top, right, bottom, and left — and fill them clockwise from the top: S, T, U, V take the top, right, bottom, and left wedges of the first X, and W, X, Y, Z take the same four wedges of the second X, each marked with a dot. Different books sometimes arrange the X letters in a slightly different order, so the safest habit is to share the exact key chart with whoever you are writing to. The chart on this page shows precisely the layout this tool uses.

A worked pigpen example

Take the word CAB. C is the top-right cell of the first grid, so it keeps the line on its left and the line below it — a corner that opens toward the top-right. A is the top-left cell, the mirror-image corner that opens toward the top-left. B is the top-middle cell, a U shape open at the top. Written out, CAB becomes three little corner-and-U symbols in a row, with no letters in sight.

Decoding reverses the process: take each symbol, find the cell or wedge whose surrounding lines match it, and read off the letter — remembering that a dot means you are in the second grid or the second X. Because the pigpen cipher is a plain one-to-one substitution, the same letter always produces the same symbol, so a careful look at repeated shapes already tells you a lot about a message, exactly as with any simple substitution cipher.

History: the Freemason and Rosicrucian cipher

The pigpen cipher is centuries old and is most famously linked to Freemasonry, which is why it is so often called the Masonic or Freemason's cipher. Freemasons used it in the 18th century to keep records and correspondence private, and gravestones in Masonic cemeteries sometimes carry inscriptions written in pigpen symbols. A closely related arrangement was used by the Rosicrucians, and the Union army is said to have used the cipher to send messages during the American Civil War.

Part of the reason it spread so widely is that it needs no equipment and almost no memorisation: once you can picture the two grids and two crosses, you can encode or decode by hand on any scrap of paper. That same simplicity is why it survives today not as a serious secret-keeping tool but as a teaching cipher, a staple of puzzle hunts, and a piece of cultural shorthand for ‘secret writing’ that turns up in games, books, and films.

How secure is the pigpen cipher?

By modern standards the pigpen cipher offers essentially no security. It is a monoalphabetic substitution with a fixed mapping and no key, so anyone who recognises the symbols — or simply guesses that the shapes stand for letters — can decode a message using frequency analysis or a published chart in minutes. Replacing letters with exotic-looking symbols changes how the message looks, not how hard it is to break.

That does not make it useless; it makes it the right tool for the right job. For puzzles, games, classroom lessons, treasure hunts, and capture-the-flag challenges, the pigpen cipher is ideal: memorable, hands-on, and satisfying to crack. For anything that genuinely needs to stay secret, use a modern, peer-reviewed algorithm such as AES instead. Keep pigpen for the fun of hiding words in plain, angular sight.

Frequently asked questions

What is the pigpen cipher?
The pigpen cipher is a simple substitution cipher that replaces each letter with a geometric symbol instead of another letter. The symbols come from two tic-tac-toe grids and two X shapes, so an encoded message looks like a row of angular marks. It is also known as the Masonic cipher, the Freemason's cipher, the Napoleon cipher, the tic-tac-toe cipher, and the Rosicrucian cipher.
Why is it called the pigpen cipher?
The name comes from the grids used to draw it: the cells of the tic-tac-toe grids look like little pens or enclosures, as if each letter were penned in like an animal in a pigpen. The same cipher is called the Masonic or Freemason's cipher because Freemasons used it, and the Rosicrucian cipher after a related arrangement used by the Rosicrucians.
How do you encode a message in pigpen?
Write the alphabet into two tic-tac-toe grids and two X shapes — A–I, then J–R, then S–V, then W–Z. To encode each letter, draw the lines that surround its position in the diagram, adding a dot when the letter is in the second grid or the second X. This tool does it for you: just type, and each letter turns into its symbol straight away.
How do you decode a pigpen cipher?
Match each symbol to the cell or wedge whose surrounding lines look the same, then read off the letter, remembering that a dot means the second grid or second X. In this tool, switch to Decode and click the symbols you see on the on-screen keyboard; the matching letters appear as your decoded message, which you can then copy.
What do the dots mean in the pigpen cipher?
The dots tell two otherwise identical shapes apart. The first grid (A–I) and the first X (S–V) have no dots, while the second grid (J–R) and the second X (W–Z) add a dot inside each symbol. So a plain square is E and a square with a dot is N — the dot shifts you to the second diagram.
Is the pigpen cipher the same as the Masonic cipher?
Yes. The pigpen cipher and the Masonic, or Freemason's, cipher are the same system; the different names simply reflect different parts of its history. Freemasons used it to keep records private in the 18th century, which is why it is so strongly associated with them, but the cipher itself is just the grid-and-cross substitution shown on this page.
Are there different versions of the pigpen cipher?
Yes. The grids-and-dots idea is standard, but the exact order of letters in the X shapes — and sometimes where the dots go — varies between books and traditions. The Rosicrucian variant arranges things a little differently. Because of this, the safest practice is to agree on, or share, the exact key chart. The chart on this page shows the precise layout this tool uses.
Can I decode a pigpen message I drew on paper?
Yes. Switch to Decode and use the symbol keyboard to click each shape you drew or found, in order, inserting spaces between words. The tool turns your clicks into letters so you can read the message. If a symbol does not match any on the keyboard, it may be from a different pigpen variant than the standard layout used here.
Does the pigpen cipher keep spaces and punctuation?
When encoding, this tool keeps your spaces and punctuation in place and only converts the letters A–Z into symbols, so the shape of your message is preserved. Digits and other characters are shown as themselves. This makes the encoded message easier to read back, which suits puzzles and teaching, where clarity matters more than concealment.
Can I download or share my pigpen message?
Yes. In Encode mode you can download your message as an SVG image, which stays crisp at any size and is easy to print, drop into a worksheet, or share. You can also copy a link that reopens the tool with your exact text and mode, so the person you send it to sees the same message and chart instantly.
Is the pigpen cipher secure?
No. It is a fixed substitution with no key, so anyone who recognises the symbols, or guesses that they stand for letters, can decode it quickly using a chart or frequency analysis. It changes how a message looks, not how hard it is to break. Use it for puzzles, games, and learning; for real secrecy use a modern algorithm such as AES.
Is my text sent to a server?
No. All encoding and decoding happen entirely in your browser, so your message is never uploaded, logged, or stored. Even a share link keeps your text in the part of the URL after the # symbol, which browsers do not send to the server, so your message stays private until you choose to share the link.

Related tools

Keep going with these handy tools

Caesar Cipher

Vigenère Cipher

Atbash Cipher

Rail Fence Cipher

Playfair Cipher

Affine Cipher