StringMash.com

Book cipher

Numbers that point into a book. Decode them, or turn a message into numbers, with the words used marked in the text.

Show the steps
  1. 115 → word 115 "instituted" → I
  2. 73 → word 73 "hold" → H
  3. 24 → word 24 "another" → A
  4. 807 → word 807 "rule" → R
  5. 37 → word 37 "equal" → E
  6. 52 → word 52 "decent" → D
  7. 49 → word 49 "entitle" → E
  8. 17 → word 17 "political" → P
  9. 31 → word 31 "of" → O
  10. 62 → word 62 "should" → S
The key, with the words used marked

Using the book cipher

To decode, paste the numbers and pick the key text. Each number counts words through the key, and the first letter of that word is the letter of the message; Take: Whole word uses the word itself, for codes that send words rather than letters. The steps show every number with the word it points to, and the key panel marks those words in the text.

To encode, switch Mode and type a message. For each letter the tool picks a word in the key that starts with it. By default it picks at random, so the same letter gets different numbers each time, which makes the code much harder to break by counting. New random set gives different numbers for the same message. Cycle steps through the matching words in order, and Always the first word repeats them, which is easier to check by hand but easier to crack.

Paste your own key text to use any book, song or letter. It stays in your browser, like everything else here. For page.line.word references, separate pages with a line of three dashes.

How a book cipher works

Both people need the same text, down to the edition. The sender finds each letter of the message as the first letter of some word in it and writes down that word's number. Without the book the numbers mean nothing, and with it they decode in minutes.

The references can count words through the whole text, as the Beale ciphers do, or give a line and a word, or a page, a line and a word. That last form is sometimes called an Ottendorf cipher, a name popularised by the 2004 film National Treasure. Whichever form, two people counting differently get different messages, which is why Count from and the hyphen handling matter.

Book ciphers in history

Benedict Arnold used a book cipher during the American Revolution, with William Blackstone's Commentaries on the Laws of England as the key text. In fiction, Sherlock Holmes breaks one in The Valley of Fear by working out which book the sender used.

The most famous are the Beale ciphers: three ciphers published in 1885, one of which decodes with the Declaration of Independence as the key. That one, cipher 2, is preloaded on the Beale page, with the Declaration numbered the way its decoder did, mistakes included.

Questions

How do I decode a book cipher?

You need the key text. Count words through it to the number, take the word's first letter, and repeat. The tool above does it for any text you paste.

What if I don't know which book was used?

Then the numbers can't be read with certainty. Guessing the book from the context, as Holmes does, is the usual way in.

Why do my numbers decode to nonsense?

Usually a different edition, or a different way of counting: starting from 0 instead of 1, or counting hyphenated words as one. Try the Count from setting, and check the key text matches the sender's.

Is my key text sent anywhere?

No. Everything runs in your browser.

Sources

Added . What's new