Book Cipher Decoder & Encoder
Paste the key text and the numbers. Each number points to a word (or a letter) in that text, and the tool shows exactly which one.
By Jack Shi · Updated
How to decode a book cipher
- Paste the key text exactly as the sender used it. Line breaks only matter for line-based references.
- Paste the numbers. The tool reads whether each group has one, two or three numbers and offers to switch to that style.
- Pick what each reference gives: one letter (most ciphers) or the whole word (messages built from words). Then read the lookup table: any number that runs past the end of the text, or lands on an unexpected word, shows up there.
Words are counted as printed by default. If the result is garbled after a certain point, switch to split hyphens: one word counted differently shifts every number after it.
Book cipher formats: word number, line.word and Ottendorf
| Style | Example | Points to | Use it when |
|---|---|---|---|
| Word number | 115 | The 115th word of the whole text; read its first letter | The key is one long text. Beale cipher No. 2 uses this style. |
| Line.word | 3.5 | Word 5 on line 3; read the first letter or the whole word | The line breaks are fixed, as in a poem, or the message is built from whole words. |
| Line.word.letter | 3.5.2 | Letter 2 of word 5 on line 3 | You need letters that few words start with (x, z). This is the Ottendorf style. |
| Letter number | 42 | The 42nd letter of the text, ignoring spaces and punctuation | The key is short and you want one number per letter. |
For page.line.word references, paste the one page the message uses and drop the page number. Benedict Arnold's book cipher used Blackstone's Commentaries on the Laws of England as its key text (Wikipedia: Book cipher).
Worked example: decoding Beale cipher No. 2
The second of the three Beale ciphers, printed in The Beale Papers (1885), is 762 numbers keyed to the Declaration of Independence (763 once one misprinted 108 is read as 10, 8). Each number is a word position; the word's first letter is the plaintext. The first seven:
| Number | Word in the Declaration | Letter |
|---|---|---|
| 115 | instituted | I |
| 73 | hold | H |
| 24 | another, | A |
| 807 | valuable | V |
| 37 | equal | E |
| 52 | decent | D |
| 49 | entitle | E |
That spells “I have de…”, the start of “I have deposited in the county of Bedford…”. Decode all 762 numbers in the tool. The other two Beale ciphers have never been solved (background; the pamphlet is on Wikisource).
Why the exact edition matters: Beale No. 2 decoded four ways
We ran the tool's decoder over Beale No. 2 (with the pamphlet's six misprinted numbers corrected) against four versions of the same key, and counted letters that match the known plaintext (763 letters):
| Key text | Correct letters | Accuracy |
|---|---|---|
| Standard Declaration text, words counted as printed | 371 / 763 | 48.6% |
| Standard text, "self-evident" counted as 2 words | 630 / 763 | 82.6% |
| Beale's printing (differs in 5 places; self-evident as 2 words) | 750 / 763 | 98.3% |
| Beale's printing + his two letter habits (811 = "y", 1005 = "x") | 763 / 763 | 100% |
Counting “self-evident” as one word instead of two drops the score from 630 to 371 correct letters, because every later word number lands one word too far along. Using the standard text instead of Beale's printing, which differs in five places, costs another 120. The last 13 errors all come from two word numbers Beale always read as “y” and “x”. Right book, wrong edition or counting rule: parts of the message turn to nonsense. Try the standard text yourself.
Method: key from Project Gutenberg eBook #1, which already reads “unalienable” and “mean time” (two words) as Beale did; Beale's word differences and misprints as documented in the Wikipedia article above; numbers transcribed from page 20 of the pamphlet. The test suite re-runs this table on every build.
How to encode a message with a book cipher
Switch to Encode, paste the key text, and type the message. For each letter the tool finds a matching position and rotates through different matches, so repeated letters do not repeat the same number. A space becomes /; anything missing from the key is kept as a quoted literal.
Example with the key “the old lighthouse / kept every sailor home” in line.word.letter style: HELLO → 1.1.2 1.1.3 1.2.2 1.3.1 1.2.1. The two L's get different references. Change one word of the key and decoding breaks, so both sides must keep identical copies.
Book cipher FAQ
What is a book cipher?
A cipher (also spelled book cypher) whose key is a text both sides already own. Each letter or word of the message is replaced by numbers that point into that text: a word number, a line and word, or a line, word and letter. Without the same text, the numbers mean nothing.
How do I decode a book cipher?
Paste the key text, paste the numbers, and pick how they point into the text (word number, line.word or line.word.letter). For each number, count to that word and take its first letter, or the whole word if the message was built from words. The tool does the counting and shows which word every number landed on.
Can you decode a book cipher without the book?
Usually not. The numbers carry no letters by themselves. What you can do is test candidate texts: the largest number tells you how long the key must be, and a correct key turns the first few numbers into real words. Even the right book fails if the edition differs, as the Beale example on this page shows.
How are words counted?
There is no single rule, and the sender's rule is what matters. This tool counts words as printed (split at spaces) by default, or can split at hyphens and apostrophes too. Beale, for example, counted "self-evident" as two words.
How do I choose a book for a book cipher?
Pick a text both sides can get in exactly the same edition, such as one fixed public-domain e-text, so word counts match. It should be long enough to contain every letter many times, so repeated letters can use different positions. Avoid the famous choices (the Bible, the Declaration of Independence): they are the first texts a solver tries.
How do I recognize a book cipher?
It is all numbers, often running into the hundreds or thousands (Beale No. 2 goes up to 1005), and the same number tends to come back wherever a letter or word repeats. Groups of two or three numbers joined by dots, dashes or colons usually mean line-word or line-word-letter references.
What is an Ottendorf cipher?
A book cipher with three numbers per letter, usually page-line-word or line-word-letter. To use page numbers here, paste the single page the message refers to and drop the page number from each group.
Is a book cipher secure?
Not for real secrets. It holds only while the key text stays unknown, and reused positions and common books give it away. Use it for puzzles, escape rooms and classroom exercises.