Home › Glossary › WIF (Wallet Import Format)

WIF (Wallet Import Format)

Also called: Wallet Import Format, WIF key, WIF private key, compressed WIF, extended WIF.

WIF (Wallet Import Format) writes a single private key as Base58Check text starting with 5, K or L, so it can be moved between wallets.

WIF, Wallet Import Format, is the standard text form of a single Bitcoin private key. It is how wallets traditionally exported and imported individual keys, and how paper wallets printed them.

How it works

A WIF string is the Base58Check encoding of:

0x80 | 32-byte private key | optional 0x01 | 4-byte checksum

The version byte 0x80 marks a mainnet private key (0xEF on testnet). The optional 0x01 suffix says the matching public key should be used in compressed form, and it changes the first character:

Key type Mainnet starts with Testnet starts with Length
Uncompressed 5 9 51 characters
Compressed K or L c 52 characters

WIF predates the BIP process, so no BIP defines it. Its main gap is that it doesn't say which address type the key was used with: a compressed key could sit behind a P2PKH, a P2SH-wrapped or a native P2WPKH address, so an importing wallet has to check them all. BIP 178, by Karl-Johan Alm, building on a proposal by Thomas Voegtlin, extends the suffix byte to record that: 0x10 for P2PKH, 0x11 for P2WPKH and 0x12 for P2WPKH inside P2SH.

BIP 38 offers a passphrase-encrypted alternative that starts with 6P, and output descriptors (BIP 380) accept WIF keys inside a script expression such as wpkh(...), which records the address type explicitly.

Modern HD wallets rarely export single keys. Treat any WIF string like cash: anyone who sees it can spend the coins, so never paste one into a website.

BIPs that define WIF (Wallet Import Format)

  • BIP 178: Version Extended WIF: Draft. Extends Wallet Import Format (WIF), the common text format for a single private key, to also record which address type the key belongs to. This helps wallets import a key and correctly find its…
  • BIP 38 (encrypted private keys): Passphrase-protected private key: Deployed. Defines a way to encrypt a private key with a passphrase, producing a printable 58-character string. It is designed for paper wallets and physical coins, so someone who finds the printed key still…
  • BIP 380: Output Script Descriptors General Operation: Deployed. Output script descriptors are a compact text language for describing exactly which addresses a wallet owns and how they are spent. This document defines their general syntax and checksum, giving…

Related terms

  • Private key: A private key is a secret 256-bit number that signs Bitcoin transactions. Whoever knows it can spend the coins it controls.
  • Base58Check: Base58Check is the original text encoding for Bitcoin addresses and keys: Base58 characters plus a 4-byte checksum from double SHA-256.
  • Public key: A public key is a point on the secp256k1 curve derived from a private key. Others use it to verify your signatures, and addresses are built from it.
  • HD wallet: An HD (hierarchical deterministic) wallet derives a whole tree of keys from one seed, as defined in BIP 32, so a single backup restores every address.

Learn more

Guides