Level 2 · First stepsThe village#103

Why 12 or 24 words: 11 bits a word, and the last word checks the rest

Each seed word carries exactly 11 bits, because the list has 2,048 words. Twelve words hold 128 random bits plus a 4-bit checksum, and 24 words hold 256 random bits plus an 8-bit checksum. Both are far beyond guessing.

Ben has a plan. Anna's seed phrase has only twelve words, and there are only 2,048 words to choose from. How hard can it be? He sharpens a pencil and writes his first guess: "abandon" twelve times.

Anna's wallet wouldn't even accept it. Twelve times "abandon" isn't a valid phrase. The last word of every phrase is partly a check on the others, and his fails it.

That's the answer to the title. Each word carries 11 bits. Twelve words hold 128 random bits plus 4 check bits, and 24 words hold 256 random bits plus 8. The number of words isn't a style choice. It's arithmetic, and it's on Anna's side.

What it is

The BIP 39 word list has 2,048 words, and 2,048 is 2 to the power of 11. So every word stands for exactly 11 bits, a number "from 0-2047" (BIP 39).

The wallet starts with random bits, called entropy, and adds a checksum: "the first ENT / 32 bits" of the entropy's SHA-256 hash, where ENT is the number of random bits. Then it cuts everything into 11-bit pieces. Most of the phrase is randomness. A small slice at the very end is a typo check.

How it works: doing the sums

  1. Twelve words. 128 random bits need a checksum of 128 ÷ 32 = 4 bits. 128 + 4 = 132 bits. 132 ÷ 11 = 12 words.
  2. Twenty-four words. 256 random bits need 256 ÷ 32 = 8 check bits. 256 + 8 = 264 bits. 264 ÷ 11 = 24 words.
  3. The lengths in between. The same rule gives 15 words (160 + 5 bits), 18 words (192 + 6) and 21 words (224 + 7). BIP 39 lists exactly these five lengths. A 13-word phrase can't exist.

Now the checksum, done by hand on a public test phrase. Never put money on it.

  1. The randomness. BIP 39's first test vector uses 128 bits that are all zero (test vectors). Eleven groups of 11 zeros give word number 0, eleven times. Word 0 on the list is "abandon" (wordlist).
  2. The check. We calculated the SHA-256 hash of those 16 zero bytes. It starts with the hex digits 37, and the first hex digit, 3, is 0011 in binary. Those four bits are the checksum.
  3. The last word. The final 11 bits are the 7 remaining zeros plus 0011: 00000000011, which is 3. Counting from 0, the list starts abandon, ability, able, about. So the twelfth word is "about".

That's why the famous test phrase that our article on multi-chain wallets used is "abandon" eleven times and then "about". It's also why Ben's twelve times "abandon" fails: its last four bits are 0000, and the check needs 0011. With 256 zero bits the same sums give 23 times "abandon" and then "art", word 102, and that matches the published 24-word vector.

The check has a useful side effect. For any first eleven words, only 2 to the power of 7, 128, of the 2,048 possible last words are valid. Change one word at random and the wallet catches it 15 times out of 16. For 24 words the check has 8 bits, so 255 random mistakes in 256 are caught.

Why it matters: nobody guesses 128 bits

2 to the power of 128 is 340,282,366,920,938,463,463,374,607,431,768,211,456, about 3.4 × 10^38.

Give Ben an imaginary machine that tries a billion billion phrases every second. We did the sum: trying them all would take about 10.8 trillion years. NASA's WMAP team puts the age of the universe at 13.77 billion years (NASA). That's roughly 780 universes, back to back.

So why 24 words? More margin, at the price of twelve more words to copy. But the lock has its own rating. The SEC 2 standard rates secp256k1, the curve Bitcoin's keys use, at a strength of 128 bits (SEC 2, 2010). Twelve words already match that. Twenty-four words can't make the curve stronger than its rating.

Where people get it wrong

  • "24 words are twice as safe as 12." Not twice: 2 to the power of 128 times more combinations. And neither length is the weak point. The paper is.
  • "2,048 words times 12 is only 24,576 options." That's adding. Each word multiplies the choices by 2,048, so twelve words give 2,048 to the power of 12, which is 2 to the power of 132.
  • "The checksum protects me from thieves." It's a spelling check, not a lock. It catches your typos, and it helps an attacker throw out invalid guesses just as fast.
  • "One missing word and it's all over." One missing word out of twelve, at a known place, leaves 2,048 candidates, and only about 128 of them pass the check. That's a long afternoon, not a lost fortune. Two missing words is a different story, covered in our article on losing a seed phrase.

When the wallet says no

When you restore a wallet and it says the phrase is invalid, the checksum has done its job. Don't hunt for a wallet that accepts it anyway. Go back to the paper: look for a misspelled word, two swapped words, or a word that isn't on the list. Then fix the paper as well, not just the screen.

Ben, meanwhile, has crossed out his first guess and moved on to "abandon" eleven times and "ability". He has about 340 undecillion to go. Good luck, Ben.

Frequently asked questions

Why do seed phrases have 12 or 24 words?

Each BIP 39 word stands for 11 bits, because the list has 2,048 words. Twelve words hold 128 random bits plus a 4-bit checksum, and 24 words hold 256 random bits plus an 8-bit checksum. Lengths of 15, 18 and 21 words are also valid.

Is a 24-word seed phrase safer than a 12-word one?

It has far more combinations, but both are beyond any guessing attack. The SEC 2 standard rates Bitcoin's curve, secp256k1, at 128-bit strength, which 12 words already match. How you store the words matters much more than how many there are.

What is the checksum in a seed phrase?

It's a few bits taken from the SHA-256 hash of the random part, stored in the last word. For a 12-word phrase it's 4 bits, for a 24-word phrase 8 bits. It lets a wallet spot most typos and reject an invalid phrase.

Why does the test phrase end with "about"?

Its random part is 128 zero bits, which gives "abandon" eleven times. The SHA-256 hash of those zeros starts with the bits 0011, so the last word's number is 3, and word 3 on the BIP 39 list is "about".

Can someone guess my 12-word seed phrase?

Not by trying combinations. There are 2 to the power of 128 possibilities, about 3.4 × 10^38. Even a machine testing a billion billion per second would need trillions of years. Real thefts come from copies of the words, not from guessing.

Sources

  1. Marek Palatinus, Pavol Rusnak, Aaron Voisine and Sean Bowe, BIP 39: Mnemonic code for generating deterministic keys
  2. BIP 39 English wordlist
  3. BIP 39 test vectors (linked from BIP 39)
  4. Standards for Efficient Cryptography Group, SEC 2: Recommended elliptic curve domain parameters, version 2.0 (27 January 2010)
  5. NASA, WMAP mission overview (age of the universe)

Read next.