7 Real Cipher and Secret Codes for Kids: A Spy Guide
Ciphers and secret codes are how real spies have hidden messages for centuries, and most of them are simple enough for a 9-year-old to master in an afternoon. From the shift cipher a Roman general used two thousand years ago to the pencil-and-paper grid codes used by prisoners of war, these are not toys, they are the actual foundations of modern cryptography. Every time you buy something online, a far more powerful descendant of these same ideas is protecting your card details.
This guide walks through seven real ciphers and codes with genuine histories, each with instructions you can try at home or in a classroom. No screens required, just paper, pencils, and a bit of sneaky thinking. They are ordered roughly from easiest to hardest, so a young agent can start at the top and work down as their skills grow, following the same path our crack detective follows in the Agent 5 mystery books.
1. The Caesar Cipher: The Oldest Trick in the Book
Julius Caesar reportedly used this one to send military messages that would mean nothing if intercepted. It could not be simpler: shift every letter of your message a fixed number of places through the alphabet. With a shift of 3, “AGENT” becomes “DJHQW”.
To write it, pick your shift number and slide each letter forward. To crack it, an enemy has to try 25 possible shifts, which is why a smart detective writes out all 25 versions until one makes sense. Try it: send a family member “L PRYHG WKH K LGGHQ OLPH” with a hint that the shift is 3, and hide an actual lime somewhere as the prize. This is the same first code kids learn to break in detective training, and there is a full detective version in our guide to writing mystery stories for kids.
2. The Reverse Cipher and the Mirror Code
The reverse cipher is the fastest code to learn: write your message backwards. “MEET AT THE TREE” becomes “EERT TA EHT TEEM”. It fools a quick glance, which is sometimes all a spy needs. Leonardo da Vinci reportedly wrote his notes in mirror writing, so the text only reads correctly when held up to a mirror.
Mirror writing takes practice. Write your message normally, then write it again with every letter flipped horizontally. A small mirror held to the spine of the paper reveals it. This one is perfect for hiding a message on the inside of a cupboard door where nobody thinks to look.
3. The Pigpen Cipher: The Freemasons’ Grid Code
The pigpen cipher looks like alien writing but is one of the easiest codes to use. Draw a grid like a noughts-and-crosses board, then draw an X through it. Give each of the 26 letters a position: first the 9 spaces of the grid, then the 9 spaces with a dot in them, then the X shapes. Each letter becomes the shape of the pen it sits in, so “A” is a shape like an open corner box and “E” is the same corner with a dot.
The Freemasons used pigpen in the 1700s to keep their rituals private, and Civil War soldiers used variants to send field messages. Because every letter has a distinct shape, it is hard to confuse letters, which makes it the best code for younger spies whose handwriting is still developing. Print the key once, and a whole classroom can pass notes that teachers cannot read at a glance.
4. The Book Code: Hiding in Plain Sight
A book code needs no key to carry, which is why resistance fighters and prisoners of war used it. You and your partner agree on a book, any book you both own. To encode, find each word of your message in the book and write down its location: page, line, and word number. “3-12-5” means page 3, line 12, word 5.
Without knowing which book, an intercepted note is meaningless, because 3-12-5 could be any word in the world. Choose a book you both have the same edition of, since different editions shuffle lines. This code teaches a bonus skill: quick dictionary and index use. Our reading list of great mystery books for 8 to 12 year olds has several titles dense enough to make excellent code books.
5. The Date Shift Code: A Cipher That Changes Every Day
The date shift code is a Caesar cipher with a twist that makes it much harder to crack: the shift changes with every letter. Use the day’s date as the key. On the 14th of a month, the first letter shifts 1, the second 4. A message sent today cannot be read tomorrow.
This is real cryptography thinking, the idea that a key that changes is stronger than one that stays the same. It also means sender and receiver must agree on the rule precisely, a great lesson in how spies get caught: usually by sloppy procedure, not by enemy genius.
6. The Tap Code: Sound Instead of Paper
The tap code was invented by prisoners of war who were forbidden from speaking to each other. Each letter is shown by two sets of taps: the first number gives the row, the second the column, of a 5-by-5 alphabet grid (where I and J share a square). Four taps, pause, two taps means row 4, column 2, the letter H.
It is slow but unstoppable. POWs tapped messages through walls for years using it, and it works through pipes, knocks on a desk, or even flashlight blinks. It teaches the deepest lesson in all of secret codes: patience beats cleverness.
7. The Invisible Ink Trick: Lemon Juice Science
Spy classics deserve a place. Write with lemon juice and a cotton bud, let it dry, and the message is invisible. Heat the paper gently, near a lamp or with a hairdryer on low, and the acid in the juice browns first, revealing the text. During the American Revolution, both sides used invisible inks, and British spies carried special reagents to reveal them.
The safety version for young agents: a grown-up handles the heat, and the message should be tested once before it matters. Real spies test their methods exactly the same way.
Frequently Asked Questions
What is the easiest cipher for kids to learn?
The Caesar cipher. Shift each letter a fixed number of places through the alphabet, agree on the number with your partner, and you can send secret messages within minutes. It was reportedly used by Julius Caesar for military messages, so it has a real spy history too.
Are these real spy codes or made up?
Real. The Caesar cipher is two thousand years old, the pigpen cipher was used by the Freemasons, the tap code carried messages between prisoners of war through prison walls, and book codes have been used by resistance fighters and soldiers. All seven in this guide are genuine historical methods.
Can these codes be cracked by a codebreaker?
Yes, and that is half the fun. A Caesar cipher falls to trying all 25 shifts. But the date shift code, the book code, and the tap code show how codes get stronger: keys that change, keys you do not have to carry, and methods that survive when paper is confiscated.
Which cipher is best for a classroom activity?
The pigpen cipher. Every letter becomes a grid shape, so it is hard to misread, needs no spelling strength, and a single printed key lets the whole class encode and decode. Follow it with a treasure hunt where each solved message gives the location of the next clue.
How do modern codes relate to these?
Modern encryption shifts letters too, just with keys thousands of digits long and mathematics far beyond pencil and paper. The core idea is identical: agree a rule with your partner, keep the key secret, and make the scramble too hard to undo by guessing. Today’s HTTPS padlock is the Caesar cipher’s great-great-grandchild.
Start Your Spy Training
Every good detective started exactly here, with a pencil, a grid, and a message nobody else could read. Pick one cipher from this list, teach it to a partner in crime this weekend, and leave your first secret message somewhere it will be found. If your young agent enjoys this, the Agent 5 mysteries put these skills to work solving full cases, and there are more detective skills to practise in our guide to observing like a detective.



