Public-key cryptography starts with a key pair: a public key you can share freely, and a private key you must guard, mathematically linked so that what one encrypts, the other can handle. RSA is the classic algorithm for that job, used for certificates, signatures, and key exchange. This generator creates a fresh 2048-bit RSA pair in your browser using WebCrypto and exports both keys in the standard PEM text format, ready to paste into a server, a certificate request, or a configuration file. The keys are generated locally and never transmitted, which matters, because a private key that crosses a network is a private key at risk.
Quick Answer: Click Generate Key Pair to create a fresh 2048-bit RSA pair and copy the PEM public and private keys.
Free Online Tool
RSA Key Pair Generator
Generate an RSA key pair via WebCrypto and export PEM public and private keys.
Keys are generated in your browser and never sent anywhere. Keep the private key secret.
How to Use the RSA Key Pair Generator
- Click Generate Key Pair.
- Wait a moment while the browser generates the keys.
- Copy the public key for sharing with anyone who needs to encrypt to you.
- Copy the private key into secure storage, and only where it is needed.
- Never paste the private key into a chat, ticket, or public page.
- Generate a fresh pair for each purpose instead of reusing one everywhere.
Key Features
- Fresh 2048-bit RSA key pair per click, via WebCrypto.
- Standard PEM export for both public and private keys.
- Public key in SubjectPublicKeyInfo format, private in PKCS#8.
- Generated and exported entirely in your browser.
- No keys are sent, stored, or logged anywhere.
- Each click produces a new, independent pair.
What the Result Means
The public key is safe to publish: it lets others encrypt messages only you can read, or verify signatures only you can make. The private key is the secret that makes that possible, and anyone holding it can impersonate you or decrypt your messages, so its storage matters more than its generation. A PEM block is just the key bytes in Base64 with header and footer lines; the format is standard, so the output works with OpenSSL, servers, and libraries without conversion. If a private key is ever exposed, the correct response is to revoke it and generate a new pair, not to hope nobody noticed.
Worked Example
A developer setting up a test server needs an RSA pair for a certificate signing request. She clicks Generate Key Pair here, copies the public key into the request workflow, and saves the private key into the server key store with restricted permissions. The certificate authority signs the public key, the server proves possession with the private key, and visitors can verify the chain. When the test server is retired, she deletes both keys, since a test pair should never graduate to production.
Best Practices and Tips
- Store private keys with file permissions that only you can read.
- Use a passphrase on private keys stored on disk where your tooling supports it.
- Generate separate pairs for separate services, so one compromise does not spread.
- Check the key size: 2048 bits is the current practical minimum for RSA.
- Delete test keys before they accumulate into a confusing pile of live credentials.
Common Mistakes to Avoid
- Sharing a private key by email or chat to save time.
- Reusing one key pair across production, staging, and personal projects.
- Generating keys on an untrusted or shared machine.
- Assuming a public key alone is enough to decrypt; decryption needs the private key.
Frequently Asked Questions
What is the difference between the two keys?
The public key encrypts and verifies; the private key decrypts and signs. Only the private key must stay secret.
Why 2048 bits?
It is the widely accepted minimum that balances security against performance for RSA today.
Can I use these keys with OpenSSL?
Yes. The PEM formats exported here are the standard ones OpenSSL reads and writes.
Is browser generation safe?
Yes, when the page is served over HTTPS and the machine is yours: WebCrypto uses the platform random source and the keys never leave the browser.
