Symmetric encryption uses the same secret key to encrypt and decrypt. It is very fast and works on data of any size, but both sides must already share the key. Asymmetric (public-key) encryption uses a key pair: anything encrypted with the public key can only be decrypted with the private key, so you can publish the public key freely. It is much slower and only handles small amounts of data, but it solves the problem of agreeing on a key with a stranger and makes digital signatures possible. Real protocols such as TLS, SSH and PGP combine them: asymmetric cryptography to authenticate and agree on a key, symmetric cryptography for the data.
At a glance
| Property | Symmetric | Asymmetric |
|---|---|---|
| Keys | One shared secret key | A public key and a private key |
| Common algorithms | AES (128, 192 or 256-bit keys), ChaCha20 | RSA, elliptic-curve (ECDH, ECDSA, Ed25519, X25519), ML-KEM |
| Speed | Very fast; hardware AES is built into most CPUs | Orders of magnitude slower per byte |
| Data size | Unlimited (streams and files) | Small: keys, hashes, short messages |
| Key size for about 128-bit security | 128 bits | RSA 3,072 bits; elliptic curve 256 bits |
| Key distribution | Hard: the key must travel secretly | Easy: the public key can be published |
| Keys needed for 100 people to talk privately in pairs | 4,950 (one per pair) | 100 key pairs |
| Signatures | No (but MACs give integrity between key holders) | Yes: non-repudiable digital signatures |
| Quantum threat | Weakened modestly; use 256-bit keys | RSA and elliptic curves broken by a large quantum computer |
| Typical uses | Disk and file encryption, VPN tunnels, TLS record data, password managers | TLS handshakes, SSH keys, code signing, certificates, encrypted email |
Key-size equivalences follow NIST SP 800-57: 112-bit security needs RSA 2,048 or a 224-bit curve; 128-bit needs RSA 3,072 or a 256-bit curve.
Symmetric encryption
A symmetric cipher such as AES turns plaintext into ciphertext with a key, and the same key reverses it. Modern modes like AES-GCM and ChaCha20-Poly1305 are authenticated: they also detect any tampering with the ciphertext. Speed is the big advantage, which is why everything bulky (a TLS connection's data, a full-disk volume, a backup) is encrypted symmetrically.
The weakness is key management. Everyone who can decrypt can also encrypt, so the key must be shared in advance over a secure channel, and the number of keys grows with the square of the number of parties: n people need n(n − 1)/2 pairwise keys.
Choose symmetric encryption when you encrypt data for yourself or for parties who already share a secret: files, databases, backups, or text protected by a password. The AES Text Encryption uses AES-GCM with a key derived from your password by PBKDF2. For integrity without secrecy between key holders, use a MAC such as the HMAC Generator.
Asymmetric encryption
Each party has a key pair. The public key encrypts or verifies; the private key decrypts or signs. Two uses dominate:
- Key agreement: Diffie-Hellman variants (ECDH, X25519) let two parties derive a shared symmetric key over a public channel; RSA can instead encrypt a random key for the recipient.
- Signatures: signing a hash with a private key lets anyone verify it with the public key. Certificates are exactly this: a certificate authority signs your public key and name. Inspect one with the Certificate Decoder.
It is slow and limited in size, and its security rests on mathematical problems that a large quantum computer could solve, which is why NIST standardised ML-KEM (FIPS 203) in 2024 for post-quantum key exchange.
Choose asymmetric cryptography when you need to talk securely with someone you have never shared a secret with, prove who you are, or sign something others will verify. Create a pair with the Key Pair Generator.
Which should you choose?
- Encrypting files, disks or large data: symmetric (AES-256-GCM or ChaCha20-Poly1305).
- Establishing a secure connection with a stranger: asymmetric key agreement, then symmetric encryption. That is what TLS does; check a site's setup with the SSL Certificate Checker.
- Sending an encrypted message to someone's public key: hybrid encryption (a random symmetric key, wrapped with their public key).
- Proving authorship or integrity to the public: a digital signature.
- Integrity between two systems that share a secret: HMAC.
For the full handshake, see How HTTPS and TLS Work.