Wallet Import Format (WIF)

1 min read

Wallet Import Format (WIF) is a standardized method for displaying Bitcoin private keys using the Base58Check encoding scheme. WIF format was standardized in order to allow all Bitcoin wallets to import and export private keys.

Learn more about Bitcoin wallets.

The process of encoding a private key into WIF format is as follows. Raw private keys are simply large numbers, which are represented as bytes. WIF format adds a prefix byte (0x80 for mainnet and 0xef for testnet) so that almost all Bitcoin private keys begin with ‘5’ or a ‘K’ on mainnet. Next, a ‘0x01’ byte is added to the end of the private key if its corresponding public key should use compressed SEC format. Finally, a four byte double SHA-256 checksum is appended to the byte-encoded private key, in order to prevent typos or tampering. This byte string is then converted from bytes to Base58Check.

Below is an example of a private key displayed as a hexadecimal number and in WIF format.

Hex: 0x224b2d71866c35d3701f0fcdd7871cb191c2ae25068602759fcb9b59d9100e00

WIF: 5J5PZqvCe1uThJ3FZeUUFLCh2FuK9pZhtEK4MzhNmugqTmxCdwE