Skip to content
buybitcoinsmart

Glossary / Addresses & keys

Wallet Import Format

Also known as WIF.

Definition
Wallet Import Format is the Base58 encoding used to move a single private key between wallets, wrapping the raw 32 bytes with a network byte and a checksum.

A WIF string is one key, not a wallet: importing it moves exactly the coins locked to that key and nothing else. Mainnet keys begin with 5 when the matching public key is uncompressed, or with K or L when it is compressed, and run 51 or 52 characters. Treat the string the way you would treat a seed phrase, because whoever reads it can spend.

How it works

Wallet Import Format exists to make a raw secret transportable without typos. Take the 32 bytes of the key, put a version byte in front (0x80 for mainnet, 0xEF for testnet), append 0x01 if the key is meant to be used with a compressed public key, then attach four checksum bytes and encode the whole payload in Base58Check. The version byte is what forces the recognisable first character, and the optional compression flag is what stretches the string from 51 characters to 52.

Those two variants matter more than they look. The trailing 0x01 does not change the key at all; it tells the importing wallet which public key form to derive, and therefore which address to look at. Get it wrong and the wallet reports a zero balance while the coins sit safely at the other address.

The checksum catches transcription errors before they cost anything. A wallet that decodes a WIF string and finds a checksum mismatch refuses it outright, so a single wrong character produces an error message rather than an empty wallet. What no checksum can do is protect a key that someone else has already read.

Where you see it

Nothing generated by a modern wallet ships as a WIF string. Seed phrase wallets under BIP-32 hold thousands of keys and have no reason to export one, so WIF turns up almost entirely in older material: paper wallets printed by browser generators, keys pulled out of pre-2013 desktop software, vanity addresses produced by a key grinder, and the strings hidden under the holograms of Casascius physical coins.

There are two ways to bring such a key into a current wallet, and the difference is not cosmetic.

Importing adds the key to your wallet and leaves it in play. The wallet can now spend those coins, but so can anyone else who ever saw the printout, the photograph of it, or the machine that generated it. Sweeping builds a transaction that sends the entire balance to a fresh address derived from your own seed phrase, after which the old key controls nothing. Sweep unless you have a specific reason not to, and assume any key that has existed on paper, in a screenshot, or in a cloud backup is already compromised.

One more habit is worth keeping: a WIF string typed into a website is gone. Generator pages, balance checkers and "wallet validators" that ask for one exist to harvest keys, and the coins are usually moved within seconds.

Wallet Import Format vs seed phrase

A WIF string carries one key while a seed phrase carries the root of an entire wallet. Under BIP-39 a 12 word phrase encodes 128 bits of entropy and a 24 word phrase encodes 256 bits, and from that root a wallet derives every key it will ever use, along every derivation path, forever. Restoring a phrase brings the whole wallet back, including addresses you never wrote down. Restoring a WIF brings back one key and its coins, which is why a key export is a recovery tool for legacy funds rather than a backup strategy.

Not to be confused with

Frequently asked questions

Should I import or sweep an old private key?

Sweep it. Sweeping sends the coins to an address derived from your own seed phrase, so the old key stops mattering. Importing keeps the old key alive in your wallet, and anyone who has ever seen it can still spend.

What does it mean when a WIF key starts with 5 instead of K or L?

It means the key was created before compressed public keys became standard, so it pairs with a 65-byte uncompressed key and a different address. Wallets that sweep old keys usually check both address forms for you.

Read next

Related terms

More in Addresses & keys