Book Cipher
Paste a text that you and your reader both hold, then write your message as positions in it — a running word number, line and word, or page, line and word. Decode a string of numbers the same way, and see exactly which word each number points to.
Both people need exactly this text. Put a line containing only --- between pages. Lines with no words are not counted.
Taking turns gives a repeated letter a different number each time, which hides the repeats a codebreaker looks for. Decoding is the same either way.
Without the slashes the decoder cannot tell where words end.
Working
Each word or letter of the message is looked up in the key text. The position is what gets written.
| Message | Written | Where in the book |
|---|---|---|
| M | 58 | Page 1, line 5, word 8: “mankind” |
| e | 7 | Page 1, line 1, word 7: “events” |
| e | 7 | Page 1, line 1, word 7: “events” |
| t | 3 | Page 1, line 1, word 3: “the” |
| word break | / | |
| a | 24 | Page 1, line 2, word 11: “another” |
| t | 3 | Page 1, line 1, word 3: “the” |
| word break | / | |
| d | 15 | Page 1, line 2, word 2: “dissolve” |
| a | 24 | Page 1, line 2, word 11: “another” |
| w | 1 | Page 1, line 1, word 1: “When” |
| n | 10 | Page 1, line 1, word 10: “necessary” |
How to Use the Book Cipher
- 1. Paste the key text. This is your book. The sample is the opening sentence of the Declaration of Independence, which is public domain. Whoever decodes needs exactly the same text, line breaks included. A line containing only
---starts a new page. - 2. Choose what a position points at. A whole word, the first letter of a word, or a single letter. First letters are the most flexible, because almost any letter starts some word.
- 3. Choose how positions are written. One running number,
line:position, orpage:line:position. Encode a message, or switch to Decode and paste numbers. - 4. Check the working. The table lists every word or letter, the position written for it, and where it sits in the book. A
?means the book could not supply it.
How a Book Cipher Works
A book cipher replaces each word or letter with a number that says where to find it in an agreed text. There is no algorithm and no key table: the book itself is the key. Anyone without the book sees a list of numbers; anyone with it reads the message by looking each one up. Variants that count by page, line and word are sometimes called Ottendorf ciphers.
Take the sample text and the message Meet at dawn, written with first letters and one running number. Counting words from the start, mankind is word 58, events is word 7, the is word 3, another is word 24, and so on:
First letters, running numbers
M E E T / A T / D A W N 58 7 7 3 / 24 3 / 15 24 1 10
Switch the address to line:position and the same message becomes 5:8 1:7 1:7 1:3 / 2:11 1:3 / 2:2 2:11 1:1 1:10: mankind is the eighth word on line 5. Longer positions are easier to check by eye, and with a printed book they are how people actually found words.
Whole words, first letters or letters
- Whole words are the most compact and the hardest to supply: every word of the message must occur in the book.
The people dissolveis3 13 15here, but a word the book lacks becomes?. - First letters need only a word starting with each letter, so a few hundred words of ordinary prose cover most of the alphabet. Q, X and Z are the usual gaps.
- Single letters let you point at any letter of the text, so coverage is almost complete, at the cost of longer messages and bigger numbers.
Repeats give the message away
If E is always written as 7, the number 7 shows up as often as E does in English, and a codebreaker can start from there. The take turns option sends each repeat of a letter to a different occurrence — E becomes 7, then 33 — so the same message reads 58 7 33 3 / 24 14 / 15 25 1 10. The decoder reads both versions identically.
Where Book Ciphers Were Used
The best-known example is the Beale papers, a pamphlet printed in Virginia in 1885 that gives three numeric ciphers said to locate buried treasure. The second was solved by taking the first letter of the word at each number in the Declaration of Independence — the method this tool uses. The other two have not been publicly solved, and many historians doubt that the story behind them is true. Benedict Arnold's 1780 correspondence with the British officer John André is reported to have used a code keyed to page, line and word in printed books, among them Blackstone's Commentaries and a dictionary. In 1942 two German agents in Cairo used Daphne du Maurier's novel Rebecca as the key for their radio messages.
The weakness is the one all three share: the key is a physical object. Edition, printing and even line breaks change the positions, which is why the tool works from pasted text. And the book can be found. A suspected spy's bookshelf is a short list of candidates, and each candidate takes seconds to try. Treat this as a puzzle and teaching tool, not as security.
Frequently Asked Questions
- What is a book cipher?
- A cipher that replaces words or letters with their positions in a text both people have. The text is the key. Positions can be a running word count, a line and word, or a page, line and word.
- How do I decode a book cipher without the book?
- You have to find the book. Look at the largest number: it is the minimum length of the text, which narrows the field. Then try plausible candidates — a Bible, a famous speech, a novel the sender owned — by pasting each into the key box in Decode mode. A candidate that produces readable text is the key; one that produces nonsense is not.
- What do page, line and word numbers mean?
- Three numbers such as 2:14:5 mean page 2, line 14, word 5. Because they point into one specific edition, the sender and receiver must hold the same printing. This tool counts lines within each page and starts the line count again after every line containing only three hyphens.
- Which text makes a good key?
- Pick a long text that you can both obtain unchanged and that contains a wide mix of words. For first-letter schemes, check that every letter you need starts a word. A few hundred words are enough for a toy; a whole book is better because it gives you many places for each letter.
- Why does the tool write a question mark?
- The key text has no word or letter that matches. Choose a different unit, such as first letters or single letters, or use a longer text. In Decode mode, a question mark means the number points past the end of the book, or has the wrong shape for the chosen address style.
- How did the Beale cipher work?
- In the solved second cipher, each number is the position of a word in the Declaration of Independence, and the plain letter is that word's first letter. The numbers in the pamphlet contain some mistakes, and its story is widely doubted.
- Is a book cipher secure?
- Not by today's standards. If an attacker identifies the book, they read everything. Repeated numbers reveal letter frequencies, and the largest number leaks the book's size. Use real encryption for anything private.