RSA Key Pair Generator
Generate an RSA public/private key pair in PEM format — 2048, 3072 or 4096 bits — entirely in your browser.
Protect your private key. Anyone who has it can decrypt your messages and impersonate you. Never share it, never paste it into websites you don't trust, and store it somewhere safe. This page does not save it: if you close the tab without downloading it, it is gone.
🔒 Your data is processed locally in your browser and is never uploaded to our servers.
How to generate an RSA key pair
- Choose the key size: RSA-2048, RSA-3072 or RSA-4096.
- Click Generate key pair. The public and private keys appear in PEM format.
- Copy or download each key. Save the private key somewhere safe: this page doesn't keep it, and it's gone when you close the tab.
Which key size?
| Size | Security level | Use |
|---|---|---|
| 2048 bits | about 112 bits | Minimum today; fine for most uses and the most compatible |
| 3072 bits | about 128 bits | Recommended for keys that must stay safe beyond 2030 |
| 4096 bits | about 140 bits | Long-term keys; slower to generate and to use |
Generating a 4096-bit key can take several seconds, especially on a phone: the browser must find two very large random prime numbers.
Public key and private key
- Public key (
-----BEGIN PUBLIC KEY-----, SPKI format): share it freely. Others use it to encrypt messages for you or to verify your signatures. - Private key (
-----BEGIN PRIVATE KEY-----, PKCS#8 format): keep it secret. It decrypts and signs. Anyone who has it can impersonate you.
Both are standard formats read by OpenSSL, Node.js, Python, Java, Go and most libraries. The keys use the public exponent 65537 and are created with the Web Crypto API, from your device's secure random generator.
Generate RSA keys with OpenSSL
| Task | Command |
|---|---|
| Private key, 3072 bits | openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:3072 -out private.pem |
| Public key from it | openssl pkey -in private.pem -pubout -out public.pem |
| Show key details | openssl pkey -in private.pem -text -noout |
| Key for SSH | ssh-keygen -t rsa -b 4096 (or -t ed25519) |
For SSH logins and Git, use ssh-keygen: SSH uses its own key format. Modern setups often prefer Ed25519 keys, which are shorter and faster.
Security notes
- The private key is not protected by a passphrase: store it like a password, or encrypt it with
openssl pkey -in private.pem -aes256 -out private-protected.pem. - Use separate key pairs for encryption and for signing.
- For production servers and certificates, many teams prefer generating keys on the server itself.
FAQ
Is the key really generated on my device?
Yes. Generation and export happen in your browser; no network request is made with your keys.
How do I test my keys?
Encrypt and decrypt a message with RSA Encrypt / Decrypt, or sign and verify with RSA Sign / Verify.
RSA or elliptic curves?
Elliptic-curve keys (ECDSA, Ed25519) give the same security with much shorter keys. RSA remains the most widely supported. See ECDSA Sign / Verify.