WIF Prefixes: 5, K, and L
WIF Prefixes: 5, K, and L
By looking at the first character of a WIF key, a seasoned Bitcoin user can immediately tell whether the key is for a legacy uncompressed address or a modern compressed address.
1. The Prefix "5" (Legacy)
If a WIF key starts with the number 5, it is an Uncompressed Private Key.
-
Structure:
0x80+ [32-byte key] + [Checksum]. -
Public Key: This key will derive an uncompressed 65-byte public key.
-
Address: This will result in a legacy
1...address. -
Example:
5HueCGU...
2. The Prefixes "K" and "L" (Modern)
If a WIF key starts with K or L, it is a Compressed Private Key.
-
Structure:
0x80+ [32-byte key] +0x01+ [Checksum]. -
Public Key: This key will derive a compressed 33-byte public key.
-
Address: This will result in a modern
1...(P2PKH),3...(P2SH), orbc1...address. -
Example:
Kz7f2Kz...orL1h8pW...
3. Why two letters (K and L)?
Because the private key is 32 bytes (256 bits), the total range of possible numbers is very large.
-
When we add the
0x01flag and encode it to Base58, some keys fall into the range that starts withK, and some fall into the range that starts withL. -
Both are mathematically equivalent in terms of "Compression Status."
4. Why this matters
If you import a 5... key into a wallet, the wallet will look for funds at the uncompressed address. If you import a K... key, it will look at the compressed address.
- Critical Fact: The same private key will show a Zero Balance if you use the wrong WIF prefix, because the funds are sitting at a different address!
| First Char | Compression | Added Byte | Public Key Size |
|---|---|---|---|
| 5 | None | None | 65 Bytes |
| K | Compressed | 0x01 |
33 Bytes |
| L | Compressed | 0x01 |
33 Bytes |
In the next section, we will explore the Compression Flag Quirk.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: