Home › Ciphers › Book Cipher

Book Cipher

A book cipher needs no alphabet, no square and no machine — just a text both parties hold. Number its words from 1, and any message built from those words becomes a list of numbers: the 4th word, the 11th word, the 16th. To a reader without the text, the numbers point nowhere; to the holder of the same page, they spell the message word by word. It is the system of the Beale papers and of wartime agents with an agreed novel. This tool numbers whatever key text you paste and encodes by pointing into it, under one stated convention, with nothing silently skipped.

In short

A book cipher is a code whose key is a shared text. The key text's words are numbered from 1; each word of the message is replaced by the number of a place where that word stands in the text. This tool cycles through a word's occurrences in order — the first THE takes its first position, the second THE its second — so common words do not map to a single tell-tale number, and decoding is exact.

Strictly a code, not a cipher: it substitutes whole words, not letters. The secret is the identity of the key text, not the method.

Encode or decode against your own key text

29 key words
Encoded · Book cipher
1 4 11 16 7 18

Everything runs in your browser — nothing is uploaded.

How it works

One convention, stated once, used everywhere

Words are numbered by a simple running index from 1 — not page.line.word, which needs a specific printed edition — and a "word" is a run of letters, digits and apostrophes, so punctuation never creates phantom entries. Encoding looks each plaintext word up in the key text and cycles through its occurrences in order: the first time you send THE it takes THE's first position, the second time its second position, wrapping when they run out — like a homophonic cipher made of words, and deterministic, so your correspondent's decode is exact.

If a plaintext word does not occur in the key text at all, the tool refuses and names every missing word: silently dropping a word would corrupt the message in a way no decoder could detect. Decoding maps each number back to the word standing at that position in the key text, in the form it appears there. Try it: add HARBOUR to the message above and the tool refuses, naming HARBOUR — the one unforgivable sin of a book cipher is a word the book does not hold.

Origin & history

The Beale papers: the book cipher's legend

In 1885 a Virginia pamphlet published three pages of numbers, said to describe treasure buried by Thomas Beale in 1820. The second page was cracked by treating the Declaration of Independence as the key text — number its words, and the numbers resolve into a description of the treasure's contents. The first and third pages, which supposedly give the location and the heirs, have resisted attack ever since, and whether they are genuine ciphers or a nineteenth-century hoax built on the one solved page remains genuinely open.

The episode is the book cipher in one story: with the right text, decoding is clerical; without it, the numbers are indistinguishable from noise. It was a working tool of agents for centuries precisely because the key is so deniable — a common book on a shelf.

Reference

The default key text, numbered

Words 1–101 THE · 2 QUICK · 3 BROWN · 4 FOX · 5 JUMPS · 6 OVER · 7 THE · 8 LAZY · 9 DOG · 10 AND
Words 11–2011 RUNS · 12 THROUGH · 13 THE · 14 GREEN · 15 FOREST · 16 TO · 17 THE · 18 RIVER · 19 WHERE · 20 THE
Words 21–2921 COLD · 22 WATER · 23 RUNS · 24 CLEAR · 25 UNDER · 26 THE · 27 OLD · 28 STONE · 29 BRIDGE

THE stands at 1, 7, 13, 17, 20 and 26 — six positions to cycle through before it must repeat a number. RUNS stands at 11 and 23.

Worked examples

THE FOX RUNS TO THE RIVER

Example 1 — encoding against the default key text

THE FOX RUNS TO THE RIVER → 1 4 11 16 7 18

Count the key text's words: THE is word 1, QUICK 2, BROWN 3, FOX 4 — so FOX encodes as 4. RUNS first occurs at 11, TO at 16. But the message's second THE cannot reuse 1: matches cycle, so it takes THE's next occurrence, word 7. RIVER stands at 18. The full encoding is 1 4 11 16 7 18 — and the cycling is doing real cryptographic work, because THE no longer has a single number an analyst can fingerprint. Decode the list and the words return in their key-text form.

Example 2 — the refusal is part of the system

THE FOX RUNS TO THE HARBOUR → refused: "harbour"

HARBOUR occurs nowhere in the key text, so no number can send it. The tool names it rather than improvising — the historical failure mode was an operator silently substituting a near word, producing messages that decode to nonsense. Reword the message or lengthen the key text.

Breaking it

As strong as the secret of the text

If attackers learn which text is the key, decoding is trivial word-lookup. If they do not, the number stream offers very little to grip: no letter frequencies survive, because nothing letter-sized is transmitted. What can leak is shape — the range of numbers hints at the key text's length, and repeated numbers (once a word's occurrences are exhausted) mark repeated words. The Beale pages show both ends of the truth: one fell the moment the right text was guessed; two have resisted for well over a century.

  • Security status: secrecy lives entirely in the choice of text.
  • What gives it away: a guessed or leaked key text — then it is not a cipher at all, just an index.
Variants

Coordinates and cousins

RelativeHow it differsSolve it with
Page.line.word book codesNumbers address a word by its page, line and position in one specific printed edition — compact, but both parties need the identical printingThis page's convention note: the running index is the edition-free form
Running key cipherA key text used letter by letter as a Vigenère key stream, instead of word by word as an indexThe Running Key page
Homophonic substitutionThe same cycling idea at letter level: common letters own several symbols, used in turnThe Homophonic page
Uses & culture

Choosing a key text that can carry a message

A book cipher is only as good as its text's vocabulary. Function words (THE, OF, AND) occur constantly and cycle beautifully; the content words your message needs may not occur at all — and this tool will name them rather than improvise. Long texts are better in every way: more coverage, and more occurrences per word to cycle through. The classical tradecraft rule follows: both parties must hold the text identically — same edition, same printing — because a single reworded sentence shifts every number after it, which is why this tool treats the pasted text, exactly as given, as the whole key. Keep the title secret and the system is a cipher; publish it and the system is a puzzle.

Practice

Against the default key text

Practice 1 — decode 1 21 22

1 21 22 → ?

Use the numbered table in the reference section.

Reveal the answer

THE COLD WATER.

Practice 2 — encode FOX AND DOG

FOX AND DOG → ?

Each word occurs in the key text; take first occurrences.

Reveal the answer

4 10 9.

FAQ

Frequently asked questions

Why running numbers instead of page.line.word?

Because page.line.word only works when both parties hold the identical printed edition, down to the typesetting — a fragile key. The running word index needs nothing but the text itself, which both sides can paste exactly. One convention, stated on the page, used by the encoder and decoder alike.

What happens if my message uses a word the key text doesn't have?

The tool refuses and lists every missing word by name. A book cipher physically cannot send such a word, and the historical failure mode — the operator silently substituting or dropping it — produces messages that decode to nonsense. Reword the message or lengthen the key text.

Why does the same word get different numbers?

Matches cycle through the word's occurrences in the key text, in order, wrapping at the end. It is the book cipher's built-in homophonic effect: common words, which dominate frequency counts, stop mapping to a single tell-tale number.

Have the Beale ciphers been solved?

One of the three has. The second Beale text was solved in the nineteenth century by using the Declaration of Independence as the key text — its numbers resolve into a description of the buried treasure's contents. The first and third texts — the ones said to give the location and the heirs — remain unsolved, and whether they are genuine ciphers at all, or a hoax built around the one solvable page, is still honestly debated.

Is a book cipher secure?

Exactly as secure as the secrecy of the key text's identity. Keep the text secret and the numbers offer an analyst almost nothing; reveal it and decoding is a clerical lookup. Never protect anything real with a text an opponent can guess.

Next steps