everykey.exposed
EN

Learn

What is WIF, and why do Bitcoin private keys start with 5, K or L?

A Bitcoin private key is just a number between 1 and about 1.16·1077. Written in decimal it can be 78 digits long, easy to mistype and impossible to check. WIF (Wallet Import Format) is the standard way to write that number so that people and wallets can copy it safely. Every key in our catalog is shown in WIF.

How a WIF key is built

  1. Take the private key as 32 bytes.
  2. Put the byte 0x80 in front of it, the marker of the main Bitcoin network (the test network uses 0xEF).
  3. If the key is meant to be used with a compressed public key, add the byte 0x01 at the end.
  4. Compute SHA-256 twice over all of that and append the first 4 bytes of the result as a checksum.
  5. Write the whole thing in Base58.

Base58 uses digits and letters but leaves out 0, O, I and l, the characters people confuse most. Thanks to the 4-byte checksum, a random typo has only about a one-in-4-billion chance of producing another valid key, so a wallet rejects the mistake instead of importing the wrong key.

Why 5, K or L?

Nobody chose the first character; it follows from the arithmetic. The marker byte 0x80 puts the whole number into a narrow range, and in Base58 every number in that range begins with the same character:

On the test network the same rules give keys starting with 9 and c.

Same key, two addresses

A WIF starting with 5 and one starting with K or L can hold exactly the same number. The only difference is the instruction for the wallet: use the uncompressed (65-byte) or the compressed (33-byte) public key. Those two public keys give two different addresses, and the same key controls both. For k = 1 they are 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm (uncompressed) and 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH (compressed).

Our catalog writes keys the classic way, starting with 5, like the oldest Bitcoin software, but shows the address of the compressed key, which wallets have used by default since 2012. A wallet that imports such a 5… key will therefore show the other address.

Keys that spell words

Consecutive numbers share their first Base58 characters, so long runs of keys begin with the same text. Among all keys there are about 2·1048 pages on which every key begins with 5KEveryKeyExposed; here is the first of them. The beginning is readable, but the keys are as good as any others, and nothing tells anyone which keys are in use.

WIF today

Modern wallets rarely show WIF. They keep one seed phrase and derive every key from it (see how secure a seed phrase is). WIF still appears when you export or import a single key, for example from an old paper wallet. The rule from the rest of this site applies in full: never type a WIF key into any website. Anyone who sees it can take the coins.

Start at page 1All articles