RSA Key Pair Generator
Generate RSA key pairs (2048/3072/4096-bit) in your browser with Web Crypto. View PEM output and encrypt/decrypt text. Keys never leave your device.
Generate key pair
How it works
- Generate creates an RSA-OAEP key pair using
crypto.subtle.generateKey— a pure software operation, fully local. - The public key is exported as SubjectPublicKeyInfo (SPKI) PEM, the private key as PKCS#8 PEM.
- Encrypt signs with the public key; Decrypt reverses it with the private key, using RSA-OAEP with SHA-256.
- RSA-OAEP is limited to small payloads (roughly modulus length / 8 minus overhead — about 190 bytes at 2048 bits), so use it for keys and short secrets, not large files.
About RSA Key Pair Generator
RSA remains one of the most widely supported asymmetric algorithms: a public key encrypts or verifies, and the matching private key decrypts or signs. Generating a pair locally means the private key is created and exported on your machine — it is never transmitted, and you are in control of storing it (and ideally protecting it with a passphrase) yourself.
For exchanging secrets, RSA is almost always used to wrap a symmetric key (hybrid encryption) rather than encrypt data directly, because of the small payload limit. For new designs, ECDH or ECDSA with P-256/384 are more efficient and give equivalent strength with smaller keys — this tool exists for interop with existing systems, key stores, and OpenSSL-based workflows. Keep the private key private: anyone holding it can decrypt anything encrypted to your public key.
The parameters the page fixes for you
`crypto.subtle.generateKey` is called with `RSA-OAEP`, SHA-256 as the hash, and public exponent 65537 — the standard choice, since small exponents like 3 make OAEP's modular inversion easier to attack. The modulus length is yours to pick from 2048, 3072 and 4096. Generation is a pure software operation on your machine, which is why a 4096-bit pair can take several seconds rather than returning instantly.
Both keys are exported through `exportKey`: the public key as SPKI, the private key as PKCS#8, each wrapped in PEM armour with 64-character lines. SPKI carries the algorithm OID together with the key bytes, so it feeds straight into `openssl pkey -pubin`; PKCS#8 is the format that can optionally carry a passphrase, though this page exports it unencrypted.
Key length in terms of real strength
RSA modulus bits are not security bits. NISTSP 800-57 puts 2048-bit RSA at about 112 bits of equivalent symmetric strength, 3072 at about 128, and 4096 at roughly 150 and above. That gap is why 2048 is now a floor to migrate off rather than a comfortable default, and why an equivalent-strength EC P-256 key is dramatically smaller and faster than RSA-3072.
OAEP also imposes a hard ceiling on a single message: with a 2048-bit modulus and SHA-256 you get 190 bytes of plaintext, 382 at 3072 and 446 at 4096 — the rest is consumed by the digest and the padding. That is why RSA earns its place by wrapping a randomly generated symmetric key, never by encrypting file contents directly.
Where the private key actually is
The key pair lives in a JavaScript variable on this page and nowhere else. It is never transmitted, and it is discarded the moment you reload or close the tab — which is genuinely the property you want from a demo, and genuinely a hazard if you close the tab before copying the private key out. There is no keyring, no passphrase prompt and no encrypted-at-rest option, so storing the exported PEM somewhere sensible is your responsibility.
One more thing to keep straight: this pair is generated with `usages: ['encrypt', 'decrypt']`, so Web Crypto will refuse to use it for signing. The FAQ's mention of verifying signatures does not apply to these keys — generating an `RSASSA-PKCS1-v1_5` or `RSA-PSS` pair would be a separate call with different usages. Encrypt and decrypt here exercise OAEP only, and there is no signature, no key fingerprint and no certificate wrapping in this tool.
Frequently Asked Questions
How do I generate an RSA key pair?
What can I do with the keys?
Is my data sent to a server?
Do I need an account or API key?
Can I use these tools offline?
All processing happens in your browser. No uploads, no tracking, no servers. Your API keys, configs, and private payloads stay private — 100% client-side.