5 Real Codes Used by Real Spies (And How to Try Them)
Real spies use codes. Not just the simple kind — secret codes have been used for thousands of years to hide messages that only the right person could read. Here are five that actually worked.
1. The Caesar Cipher
Julius Caesar — yes, the Roman general — used this one over 2,000 years ago. You shift every letter in the alphabet by a set number. If you shift by 3, A becomes D, B becomes E, and so on. “HELLO” becomes “KHOOR.” Simple but effective when nobody else knew the shift number.
🔑 Try it: Can you decode this? DJHQW ILYH (shift of 3, read backwards)
2. Invisible Ink
During World War One, spies used lemon juice to write messages. The writing is invisible when dry but turns brown when you hold the paper near heat. You can try this at home with lemon juice and a cotton bud. Write your message, let it dry completely, then hold it near a lamp.
Spies also used milk, vinegar, and even urine as invisible ink during wartime. Each substance reacts differently to heat, and some need a specific chemical developer rather than plain heat. During World War Two, the British intelligence service MI6 developed special invisible ink tablets that spies could carry without raising suspicion — they looked like ordinary aspirin. A spy would dissolve one in water, write their message, and the paper would look completely blank until treated with the right chemical.
3. The Pigpen Cipher
Used by the Freemasons and later by soldiers during the American Civil War, this code replaces each letter with a shape — a section of a grid or a V shape. You draw the grid, put letters in the sections, and your code looks like a strange series of angles and lines that only someone with the key can read.
The Pigpen Cipher is one of the easiest codes to learn and one of the hardest to crack if you do not have the key. The grid has four sections, each containing two letters, and dots are added to show which letter in that section you mean. Confederate soldiers used it to send messages across enemy lines, and it appears in puzzles and escape rooms to this day. You can draw the full grid in under a minute and start sending coded messages immediately.
4. The Book Cipher
Pick any book. Instead of writing the actual words of your message, you write a series of numbers. Each number refers to a page, a line, and a word in the book. Unless someone has the exact same edition of the same book, the message is unreadable. This one has been used by real spies as recently as the 20th century.
The book cipher is practically unbreakable because the code changes with every book. A message encoded using a copy of The Hobbit can only be decoded by someone holding the exact same edition. During the Cold War, Soviet spies were known to use book ciphers with specific editions of common books — dictionaries, atlases, and popular novels — so the key was easy to carry and impossible to find if you did not know which book to look for. The weakness is that both the sender and receiver need the same book, which makes it awkward for quick communication.
5. Morse Code
Not exactly a secret code — Morse translates letters into dots and dashes — but it has been used to send hidden messages in ways people could not intercept. POW prisoners in Vietnam tapped Morse code on walls to communicate without guards understanding. A US Navy officer blinked it in a message broadcast on live television.
Morse code is still taught by scouting organisations and military signal corps around the world. The most famous sequence is SOS: three dots, three dashes, three dots. It was chosen because it is easy to remember and hard to confuse with anything else. You can learn the full alphabet in an afternoon with a friend and a flashlight — one person flashes the code, the other writes down the letters. It works across rooms, across fields, and even underwater if you tap on a pipe.
Why Codes Matter for Young Detectives
Learning codes is not just a fun party trick. It teaches pattern recognition, logical thinking, and patience — all skills that real detectives and spies rely on every day. When you learn a cipher, you are training your brain to look for structure in things that seem random. That is exactly what you do when you solve a mystery, decode a puzzle, or figure out who left that muddy footprint in the hallway.
If you enjoyed these codes, you will love the puzzles in the Agent 5 mystery books. Every book has codes to crack, clues to follow, and a mystery that only a sharp reader can solve. And if you want more hands-on detective training, try running a mystery mission at home — it uses several of these codes.
Agent 5 uses codes in every mission. Which of these would YOU use to send a secret message? Let us know in the comments.
Ready for the Next Mystery?
Join Agent 5 on the next adventure. Sign up for book news, behind-the-scenes stories, and writing tips.
Get Updates →





