What is a BIP39 mnemonic?
BIP39 is the Bitcoin Improvement Proposal that defines how to write a random number as a list of ordinary words. Crypto wallets use it for the recovery phrase: 12 or 24 words that you can write on paper and that rebuild every key of the wallet. The idea is that people copy words more reliably than long strings of hex, and a built-in checksum catches most typing mistakes.
The mechanism is short. Start with random entropy of 128 to 256 bits, in steps of 32. Append a checksum, the first bits of the SHA-256 hash of the entropy: 4 bits for 128 and 8 bits for 256. Cut the result into groups of 11 bits, and each group picks one word from a fixed list of 2,048. So 128 bits become 12 words, 160 become 15, 192 become 18, 224 become 21 and 256 become 24. To get an actual wallet seed, the words (plus an optional passphrase, sometimes called the 25th word) go through PBKDF2 with HMAC-SHA512 and 2,048 rounds, which produces 512 bits that wallets then derive keys from.
This page goes both ways. Pick a length and a language and it generates entropy and the matching words, or paste your own hex entropy to get the words, or type words to get the entropy back with the checksum verified, plus the 512-bit seed with the passphrase you choose. Ten word lists are available: English, Chinese (simplified and traditional), Czech, French, Italian, Japanese, Korean, Portuguese and Spanish. It is a tool for developers testing wallet code and for learning how the format works. Everything runs locally, but do not use words made on a web page for a wallet that will hold real funds; generate those on a trusted offline device. For other random secrets, see the token generator.
From the seed the page also derives BIP32 keys: type a derivation path such as m/44'/0'/0'/0/0 and it shows the extended private key (xprv) and extended public key (xpub) at that point, for mainnet or testnet. An apostrophe or h marks a hardened step. The results match the official BIP32 test vectors.
How to generate a BIP39 mnemonic
- Open the page: it already shows random entropy and its words. Choose the Language of the word list and the Length: 12, 15, 18, 21 or 24 words, each with its bit count.
- The entropy is in Entropy, hexadecimal and the matching words in Mnemonic. Press Generate new entropy for another.
- To start from your own entropy, paste 32, 40, 48, 56 or 64 hexadecimal characters. The words update at once.
- To start from words, type or paste them in Mnemonic, separated by spaces. The entropy is recovered and the checksum is checked.
- For the seed, optionally type a BIP39 passphrase. The Seed (512 bits, hexadecimal) appears once the words are valid.
- Copy the entropy or the mnemonic with their buttons.
Examples
All-zero entropy
Entropy 00000000000000000000000000000000 (128 bits), English:
abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon aboutEleven words are the first of the list because the entropy bits are zero, and the last carries the checksum. This is the first test vector of the BIP39 specification.
A seed with a passphrase
The same words with the passphrase TREZOR give this 512-bit seed, and with an empty passphrase it starts with 5eb00bbddcf06908:
c55257c360c07c72029aebc1b53c05ed0362ada38ead3e3e9efa3708e53495531f09a6987599d18264c1e1c92f2cf141630c7a3c4ab7c81b2f001698e7463b04A different passphrase gives an entirely different seed and, with it, a different wallet. There is no "wrong" passphrase, only another wallet, which is also why forgetting one is unrecoverable.
More entropy, other words
Entropy 7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f:
legal winner thank year wave sausage worth useful legal winner thank yellowAnd ffffffffffffffffffffffffffffffff gives zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong, the last word of the list used eleven times plus the checksum word.
Common errors and how to fix them
- "The entropy must be hexadecimal: only the digits 0-9 and the letters a-f.": remove spaces and other characters.
- "The entropy has N characters. Use 32, 40, 48, 56 or 64 hexadecimal characters (128 to 256 bits, 12 to 24 words).": the length does not map to a valid word count.
- "A BIP39 mnemonic has 12, 15, 18, 21 or 24 words; this one has N.": a word is missing or extra.
- "Word N, "x", is not in the word list of this language. Check the spelling or the language.": a typo, or you pasted words from a list in another language.
- "The last word does not match the others (the checksum is wrong). A word may be wrong, missing or out of order.": the words are all valid, but together they are not. Check the order first.
- The seed differs from my wallet: the wallet may have used a passphrase, another language or its own derivation path. The seed here is only the first step.
Frequently asked questions
Is a BIP39 mnemonic the same as a password?
No. It encodes random bytes, while a password is chosen by a person. Do not invent your own words: a phrase you pick is far less random than one drawn from the entropy. To judge a password, use the password strength analyser.
What is the BIP39 passphrase (25th word)?
An optional extra string mixed into the seed. It creates a separate wallet from the same words, so it works as a second factor, but if it is lost the funds are lost too.
How many bits of security does 12 or 24 words give?
12 words carry 128 bits of entropy and 24 words carry 256. Four of the bits (12 words) or eight (24 words) are the checksum, which adds no strength.
Can I use a word list other than English?
The format allows it and this page offers ten lists. Check that your wallet supports the list you pick, since many accept only English.
Generate a BIP39 mnemonic in code
JavaScript
import * as bip39 from 'bip39';
const mnemonic = bip39.generateMnemonic(128); // 12 words
const seed = bip39.mnemonicToSeedSync(mnemonic, 'TREZOR').toString('hex');Python
# pip install mnemonic
from mnemonic import Mnemonic
words = Mnemonic('english').generate(strength=128)
seed = Mnemonic.to_seed(words, passphrase='TREZOR').hex()Go
// import "github.com/tyler-smith/go-bip39"
entropy, _ := bip39.NewEntropy(128)
mnemonic, _ := bip39.NewMnemonic(entropy)
seed := bip39.NewSeed(mnemonic, "TREZOR")Bash
openssl kdf -keylen 64 -kdfopt digest:SHA512 \
-kdfopt "pass:abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" \
-kdfopt salt:mnemonicTREZOR -kdfopt iter:2048 -binary PBKDF2 | xxd -p -c 64