A public key is the shareable half of a key pair used in public-key, or asymmetric, cryptography. Its owner can publish it freely; other people use it to encrypt information that only the owner can read, or to check that a message or transaction really was signed by the owner. It is generated together with a matching private key, which must stay secret.
Public keys underpin secure websites, encrypted email, software updates, bank card chips and every major cryptocurrency. The idea was set out publicly by Whitfield Diffie and Martin Hellman in 1976, and the RSA algorithm, published by Ron Rivest, Adi Shamir and Leonard Adleman in 1977, made it practical. The general family of keys is described under cryptographic key.
Public key in plain terms
Think of a padlock that you hand out to anyone who asks. People can use your open padlocks to lock boxes and send them to you, but only you hold the key that opens them. Handing out padlocks is safe, because a padlock alone does not open anything.
The public key is the padlock. It works the other way too: if you stamp a letter with a seal only you can make, anyone holding your public "seal checker" can confirm the stamp is genuine without being able to forge it. That second use, proving who sent something, is what cryptocurrencies rely on.
How public-key cryptography works
A key pair is created by a mathematical process that is easy to run in one direction and practically impossible to reverse. With RSA, the hard problem is factoring a very large number into its two prime factors. With elliptic-curve cryptography, used by Bitcoin and Ethereum, it is recovering a secret number from a point on a curve. Anyone can compute the public key from the private key, but not the reverse.
The pair supports two main operations:
- Encryption. A sender encrypts data with the recipient's public key, and only the matching private key can decrypt it. The mechanics are covered in data encryption and decryption.
- Signatures. The owner signs data with the private key, and anyone can check the digital signature with the public key.
- Key agreement. Two parties combine their key pairs to arrive at a shared secret over an open channel, which is how most secure web connections begin.
On the web, a public key is bound to a domain name by a certificate issued by a certificate authority, so a browser knows it is talking to the real bank and not an impostor. This structure supports much of modern data security and digital identity.
Public keys in cryptocurrency
In cryptocurrency, a public key identifies who may spend coins. Bitcoin (BTC) uses the secp256k1 elliptic curve, with ECDSA signatures and, since the Taproot upgrade activated in November 2021, Schnorr signatures as well. Ethereum (ETH) uses the same curve.
A wallet address is usually not the public key itself but a shorter value derived from it by hashing. Bitcoin's older address types hash the public key with SHA-256 and then RIPEMD-160; an Ethereum address is the last 20 bytes of the Keccak-256 hash of the public key. When a user spends, the network checks the signature against the public key and the key against the address. Every such check is recorded on a public ledger, which is why keys and addresses are visible to all.
Wallet software normally generates key pairs from a seed phrase, so one backup can restore many keys. More advanced setups split control: a multi-sig wallet needs signatures from several keys, and a multi-party computation (MPC) wallet never assembles the full private key in one place. Privacy techniques such as ring signatures and zero-knowledge proofs hide which public key signed a transaction.
Risks and limitations
A public key is only as trustworthy as the link between it and its owner. If an attacker tricks someone into using the wrong key or address, funds go to the attacker; the wallet address poisoning scam exploits exactly this by planting look-alike addresses in a victim's history. Losing the private key, meanwhile, leaves the public key useless, which is the point of the saying "not your keys, not your coins".
The longer-term threat is quantum computing. A large enough quantum computer running Shor's algorithm could derive private keys from public keys for RSA and elliptic-curve systems. In August 2024 the US National Institute of Standards and Technology published its first post-quantum standards, FIPS 203, 204 and 205, and banks, governments and blockchain developers have begun planning migrations. Coins whose public keys are already exposed on-chain, for example through address reuse, are the most often cited concern.