# Generating mnemonic phrase through CLI

**URL:** <https://forum.cardano.org/t/generating-mnemonic-phrase-through-cli/8908>\
**Category:** Developers\
**Created:** [1 March 2018 19:34 UTC](https://forum.cardano.org/t/generating-mnemonic-phrase-through-cli/8908 "2018-03-01T19:34:40Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![vantuz-subhuman](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.cardano.org/vantuz-subhuman/32/3976_2.png) [@vantuz-subhuman](https://forum.cardano.org/u/vantuz-subhuman)\
**Post date:** [12 May 2018 19:46 UTC](https://forum.cardano.org/t/generating-mnemonic-phrase-through-cli/8908/8 "2018-05-12T19:46:01Z")

</div>

> [@nsticco](#):
>
> So, the preferred method is to use a larger dictionary then?

What do you mean by “larger dictionary”? There are exactly 2048 words that may be used as a mnemonic, as can be seen in this list: [https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt](https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt)

Furthermore - **not all** word combinations may be used as a wallet. There’s a special property of the **checksum** that must be held. Only about 1 in each 256 combinations may be used as a valid wallet.

BIP39 mnemonics are **secondary** and are obtained from generated randomness as explained in this document: [https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)

So just trying to select 12 words from the list **might** work, but not a proper way to create wallets. Proper algorithm looks somewhat like this:

1. Generate 128 bits of randomness
2. Calculate checksum of the resulting bytestring
3. Take first 4 bits of the checksum and append them to the original randomness
4. That will give you the bytestring of 132 bits
5. Split 132 bits into 12 groups of 11 bits
6. Convert each 11-bit word to a decimal number
7. That will give you 12 numbers between 0 and 2047
8. Use standard list or words to select 12 mnemonic words for each number (by index)

That will give you 12 words that you can send to the wallet creation API. You probably might easily find existing BIP39 library for any language of your choice that will allow you to generate those words, or at least indexes.

**Generating proper randomness is not that trivial!** Put some thought into how you’re going to to this part.

---

_[View the full topic](https://forum.cardano.org/t/generating-mnemonic-phrase-through-cli/8908)._
