Skip to main content
What Is a Private Key in Crypto?

What Is a Private Key in Crypto?

One private key can be written as 64 hex characters, a Bitcoin wallet import format (WIF) string, or a keystore file, and only the keystore needs a password before anyone can sign with it.

Level
Beginner
Reading time
8 min
Last updated

Overview

Introduction

A Bitcoin or Ethereum private key is a single 256-bit number made from random data. Whoever knows that number can sign transactions that move the coins at its addresses, and no bank or support desk can replace it once it's gone.

Wallets that start from a seed phrase derive their keys from it and sign on your device without ever showing them. A key surfaces only when you export one, import one, or dig out an old paper wallet, and those are the moments when someone else can see it too.

What Is a Private Key in Crypto?

A private key is the secret that lets a crypto wallet spend from an address. Bitcoin's developer guide puts every valid key between 0x01 and a ceiling just under 2 to the power of 256, a range set by the secp256k1 curve that Bitcoin uses. Nearly every 256-bit number falls inside it, so a random draw almost always gives a usable key.

The coins never move into the wallet app. The blockchain records balances against addresses, and the wallet holds or derives the key that can authorize a transfer from them. In the words of ethereum.org's account docs, “You never really hold cryptocurrency, you hold private keys.”

Private Keys, Public Keys, and Addresses

A wallet computes the public key from the private key with elliptic curve math, then hashes it into a wallet address. Ethereum.org notes that a private key can't be derived from public keys, so the public end of that chain gives nothing away about the secret at its start.

That's why anyone can send BTC to your Bitcoin address, yet only the matching private key can spend what arrives. Each item on the left below comes with its sharing rule on the right.

Wallet address

Public, shown on block explorers

Public key

Shareable, only verifies signatures

Private key

Secret, signs and moves funds

Seed phrase

Secret, regenerates many private keys

Wallet password

Private, opens the app on one device

Exported key file

Secret, as safe as its password

A website that offers to check, validate, or convert a private key gets a copy the moment you paste it in. Looking up a balance or a transaction history needs only the address.

How a Private Key Signs a Transaction

The key never leaves your device during a send, because the wallet signs locally and only the signed transaction goes out to the network.

Bitcoin signs with the Elliptic Curve Digital Signature Algorithm (ECDSA) on the secp256k1 curve, and Ethereum's Yellow Paper specifies ECDSA on the same curve for its transactions. Bitcoin's Taproot spends use Schnorr signatures over secp256k1 instead, as defined in Bitcoin Improvement Proposal (BIP) 340. The RSA keys common on web servers and in certificates belong to a different algorithm, and Bitcoin and Ethereum wallets don't sign with them.

Bitcoin's developer guide adds that the signature makes the rest of the transaction tamper-proof, so a node relaying it can't change the amount or the recipient without breaking the signature. A valid signature proves only that the key approved the transaction, though, and says nothing about whether the details are right. A wallet will sign a payment to a mistyped address or a malicious contract approval just as readily, so step two of every send is yours.

  1. The wallet builds an unsigned transaction with the destination, amount, network, and fee.
  2. You check those details before confirming.
  3. The wallet signs on your device with the private key.
  4. The signed transaction goes out to the network.
  5. Nodes verify the signature with the public key.

No key can undo a confirmed send. After that point, getting funds back depends on the receiver, a custodian, or a separate protocol process.

Private Key vs. Seed Phrase

A seed phrase backs up a whole wallet, and a private key is one of the keys the wallet derives from it. Under BIP 32, one seed can generate many private keys, so restoring the phrase brings back every account the wallet created. MetaMask's help pages describe the split from the key's side, with each account's private key controlling that one account and no other.

A phrase regenerates its keys, but no key leads back to the phrase, so an exported key can't stand in for a lost seed.

Private Key Formats, From Hex to Keystore Files

Raw hex is the number itself, 64 characters from 0 to 9 and A to F for its 32 bytes. Hex has no error check, so one mistyped character produces a different, equally valid key.

Wallet import format (WIF) is the most common way to write a key in Bitcoin, according to the Bitcoin wiki. It adds a version byte in front, an optional 0x01 flag at the end when the key belongs with a compressed public key, and a 4-byte checksum, then encodes the result in Base58. On mainnet, a WIF key is 51 characters starting with 5, or 52 characters starting with K or L once the flag is set. The checksum lets a wallet catch a typo before it imports the key.

A keystore file holds the key encrypted under a password, in the JavaScript Object Notation (JSON) format set out in ethereum.org's Web3 Secret Storage definition. A key derivation function (KDF) turns the password into a derived key. Its first 16 bytes encrypt the private key with AES-128-CTR, the Advanced Encryption Standard (AES) in counter mode.

The next 16 bytes and the encrypted key make a message authentication code (MAC), so the wallet can tell whether a password is right before it decrypts anything. MetaMask imports these JSON files in its browser extension only.

A file kept next to its password, or locked with a short or reused one, is close to a plain copy of the key, and a forgotten password can leave the file unusable for good.

One test private key, three wrappers, and only one needs a password

The Web3 Secret Storage test key written as raw hex, as a compressed Bitcoin WIF string, and inside a PBKDF2 keystore file, with every encoding computed and checked against the specs.

Hex and WIF are the same key in the clear, while a keystore file keeps it encrypted under a password that the MAC checks before anything is decrypted.

The key is a test value printed in a public spec, so it must never hold funds. Only the spec's PBKDF2 keystore is drawn, since its scrypt test vector does not reproduce with the parameters it lists. The WIF shown is the mainnet compressed form, and the uncompressed form starts with 5.

Where Private Keys Live

Wallets come as apps, browser extensions, devices, and paper, and they differ in who holds the signing key. The types of crypto wallets are listed below on the left, with where each one keeps its keys on the right.

Custodial account

With the platform, which signs withdrawals for you

Non-custodial wallet

With you, inside the app or device you control

Hot wallet

On an internet-connected phone, browser, or computer

Hardware wallet

On a dedicated device that signs without exposing the key

Cold storage

Away from devices that go online for everyday use

Multi-party computation (MPC) wallet

Split into key shares, a set number of which sign together

Smart contract account

Signer keys that the account’s own code accepts

Paper wallet

Printed as text or a QR code

Paper wallets need extra care, because a printed key may have been photographed, scanned, or handled by others long before you find it again.

What Happens If a Private Key Is Lost, Exposed, or Imported

An exposed key can't be changed, because the address stays tied to that key permanently. The Bitcoin wiki's advice for a compromised key is to spend the coins straight away to a new, secure address.

A lost key that came from a seed phrase returns when you restore the phrase. A standalone key with no copy is gone, and while a block explorer still shows its balance, nobody can spend it.

A stolen phone or laptop calls for the same move as an exposed key if the device or its backup may be compromised. After a malicious contract approval, revoke the approval first, then move the assets if the risk remains.

When you export a key, MetaMask shows it in clear text and asks you to make sure nobody else can see it or capture a screenshot while it's on screen. Its import page warns that exporting a key leaves you open to clipboard hacks and suggests typing in your Secret Recovery Phrase where that's an option.

A private key imported into MetaMask adds a single account, and imported accounts don't appear automatically when you restore the wallet from its Secret Recovery Phrase. The imported key needs a backup of its own. If the wallet signs in through Google, Apple, or Telegram, the imported account also becomes linked to that login.

A sweep removes that need by sending everything the old key controls to a new address in your wallet, where the seed phrase already covers it. Some wallets and services require a sweep. Bitcoin Core can also import a key without one, an option the Bitcoin wiki calls very dangerous outside specific cases, since coins on an untrusted or insecure imported key can be stolen at any time. For an old paper wallet, that makes the sweep the safer route.

How to Protect Private Keys Without Creating New Risks

Protecting a key has two sides, keeping it away from thieves and keeping a copy that you or an heir can still reach. A backup hidden so well that nobody can find it fails the second test.

Never type or paste a private key or seed phrase into a website, support form, browser pop-up, recovery tool, or direct message. On Jun. 3, 2025, the Federal Bureau of Investigation (FBI) warned about criminals using non-fungible token (NFT) airdrops, disguised as free rewards, against non-custodial wallet users on the Hedera network. Memo links in those airdrops led to third-party sites that often asked for login and security information, seed phrases included, and whatever users entered let the criminals steal their crypto.

Impersonators make the same request while posing as officials or support staff. The Commodity Futures Trading Commission (CFTC) says it doesn't audit or verify customers' digital asset wallets and would never ask for private keys or seed phrases. MetaMask says no one from its team, support included, will ever ask for your private key.

Each habit below closes one way a key gets out.

  • Keep keys and phrases out of screenshots, cloud notes, email drafts, and chat apps.
  • Install wallet software only from the maker's own site or official store listing.
  • Reveal or export a key only when you need to, and clear the clipboard afterward.

Before a large deposit, a backup plan should already say who can recover the wallet if you can't, what happens if one copy is destroyed, and what stops a stranger who finds a copy from using it at once.

Matching Key Control to How You Use Crypto

How much you hold, how often you move it, and how much recovery work you can take on all shape where your keys should be. A spending balance, long-term savings, and a trading account each fail in different ways, so many setups keep them apart.

  • Daily app use. A small balance in one of the crypto wallets for beginners, backed up before the first deposit.
  • Long-term holding. A hardware wallet with an offline backup.
  • Active trading. Only what you trade, held on one of the safest crypto exchanges, with the rest withdrawn.
  • Family or business funds. Recovery and approval rules agreed before funding.

FAQs

Is a private key the same as a seed phrase?

No, and the difference shows when one leaks. An exposed private key puts one account at risk. An exposed seed phrase puts every account derived from it at risk, including addresses the wallet hasn’t shown you yet.

Can someone guess a private key?

Not a properly random one, though weak randomness can leave keys open to theft. On Aug. 11, 2013, bitcoin.org warned that weaknesses in the part of Android that generates secure random numbers left every wallet generated on Android up to then vulnerable. Apps where users didn’t control the keys were unaffected, and everyone else was told to send their coins to a new address made with a repaired random number generator.

Can a public key or wallet address reveal my private key?

No. An extended public key, or xpub, needs more care. It reveals no private key on its own, though it lets anyone list every address in that branch of your wallet and follow its activity, so treat it as private information.

Do I have private keys on an exchange?

Not in a custodial exchange account. The exchange holds the keys to its deposit addresses and signs withdrawals itself, so your controls are the login, two-factor authentication, and withdrawal settings. If an app from the exchange shows you a recovery phrase to write down, that part is a self-custody wallet, and its keys are yours.

Should I import or sweep an old private key?

Sweep, in most cases. A sweep is an ordinary transaction with its own network fee, and once it confirms, the old key shouldn’t receive funds again. The Bitcoin wiki calls reusing such an address possible but inadvisable and insecure.

What should I do if I accidentally shared my private key?

Move the funds to a new wallet with fresh keys straight away. Changing the wallet password or reinstalling the app won’t help, because the key itself is the credential and works in any wallet that imports it.

Loading image…

The Catalyst

Know what’s moving crypto.