RSA Key Pair Generator
Generate 2048, 3072 or 4096-bit RSA key pairs in PEM and JWK, in your browser, with the NIST key-size guidance and the FIPS 186-5 exponent.
RSA Key Pair Generator
ssh-keygen, openssl, or a hardware security module.
How to use the RSA key pair generator
Pick a key size
NIST SP 800-57 rates 2048-bit RSA at 112 bits of security, acceptable for protecting data through 2030, and 3072-bit at 128 bits, acceptable beyond. 3072 is the default here. 4096 gives more margin but is slower to generate and use.
Click Generate
The browser's Web Crypto API finds the two primes. How long it takes depends on your device and on luck in the prime search; 4096-bit keys can take noticeably longer, and the page tells you the time it took.
Copy or download the keys
You get the public key as SPKI and the private key as PKCS#8, each in PEM, plus both as JWK. Store the private key with restricted permissions, for example chmod 600 on Linux and macOS.
Use, then rotate
Use these keys for testing and learning. For production, generate keys on the machine or hardware that will use them, with openssl, ssh-keygen or a hardware security module, so the private key never passes through a web page.
RSA — the algorithm behind half the world's TLS
RSA is a public-key algorithm named after Ron Rivest, Adi Shamir and Leonard Adleman. A key pair rests on two large primes: the public key holds their product, the modulus, and an exponent; the private key holds the information needed to reverse the operation. Its security depends on how hard it is to factor the modulus. The current specification of RSA cryptography is RFC 8017 (PKCS #1 v2.2).
Choosing a key size
NIST SP 800-57 Part 1 Rev. 5 maps RSA key sizes to security strengths: 2048 bits gives 112 bits of security, 3072 gives 128, 7680 gives 192 and 15360 gives 256. Its Table 4 says 112-bit strength is acceptable for applying protection through 2030 and disallowed from 2031, while 128 bits and above remain acceptable. That is why this page defaults to 3072 and labels 2048 with its end date.
"The exponent e shall be an odd, positive integer such that 216 < e < 2256." FIPS 186-5
The public exponent
Every key this page generates uses e = 65537 (0x10001), which satisfies FIPS 186-5. Until 1 October 2026 the page also offered e = 3, which falls below the FIPS 186-5 lower bound; that option has been removed.
PEM, PKCS#8, SPKI and JWK
The keys are the same numbers in different wrappers. PEM is base64-encoded DER between BEGIN and END lines: this page exports the public key as SubjectPublicKeyInfo ("PUBLIC KEY") and the private key as PKCS#8 ("PRIVATE KEY"). A JSON Web Key (RFC 7517) holds the same values as named base64url fields, the form published at JWKS endpoints. OpenSSH uses its own file format; convert with ssh-keygen if you need it.
Alternatives and what comes next
Elliptic-curve keys are much smaller for similar strength: RFC 8032 describes Ed25519 as "intended to operate at around the 128-bit security level", the same as RSA-3072. For the longer term, NIST has published post-quantum standards, ML-KEM for key establishment (FIPS 203) and ML-DSA for signatures (FIPS 204), because a large enough quantum computer would break RSA.
Key sizes by NIST strength, the FIPS 186-5 exponent, and the formats
NIST SP 800-57 rates 2048-bit RSA at 112 bits of security and 3072-bit at 128 bits.
112-bit strength is acceptable for new protection through 2030 and disallowed from 2031 (SP 800-57 Table 4).
Matching 256-bit symmetric strength needs a 15,360-bit RSA modulus, according to SP 800-57.
FIPS 186-5 requires the public exponent to be odd and between 216 and 2256; 65537 qualifies, 3 does not.
This page exports the public key as SPKI and the private key as PKCS#8, in PEM and as JWK.
A JSON Web Key (RFC 7517) stores the same key material as named base64url fields.
RSA cryptography is specified in RFC 8017, PKCS #1 version 2.2.
RFC 8032 puts Ed25519 at around the 128-bit security level, comparable to RSA-3072.
NIST's post-quantum standards are ML-KEM (FIPS 203) and ML-DSA (FIPS 204).
Clear now removes the generated keys from the page, rather than only hiding them.
Frequently asked questions
Method & sources
How it computes
RSASSA-PKCS1-v1_5 key pair from the Web Crypto API at 2048, 3072 or 4096 bits with e = 65537, exported as SPKI and PKCS#8 PEM and as JWK. Clear now wipes the key text from the page.
What this tool implements
- The page offered e = 3; FIPS 186-5 requires an odd e with 2^16 < e < 2^256, so the option is removed. Clear only hid the private key; it now removes it. Key-size labels follow SP 800-57: 2048 = 112-bit (acceptable through 2030, disallowed from 2031), 3072 = 128-bit; 15360 for 256-bit.
- Removed or corrected: 'RSA-260 (829 bits) factored in 2020' (829 bits is RSA-250; no source read), 'OpenSSH defaults to Ed25519 since 2014', Cocks/GCHQ history, signing-speed and quantum-timeline estimates, and 'Kyber/Dilithium' (now ML-KEM and ML-DSA, FIPS 203/204). Ed25519's ~128-bit level is from RFC 8032.
Sources
- Barker E. NIST SP 800-57 Part 1 Rev. 5: Recommendation for Key Management (Tables 2 and 4). NIST; 2020. https://doi.org/10.6028/NIST.SP.800-57pt1r5
- NIST. FIPS 186-5: Digital Signature Standard (public exponent 2^16 < e < 2^256). 2023. https://doi.org/10.6028/NIST.FIPS.186-5
- Moriarty K, et al. RFC 8017: PKCS #1: RSA Cryptography Specifications Version 2.2. IETF; November 2016. https://www.rfc-editor.org/rfc/rfc8017
- Jones M. RFC 7517: JSON Web Key (JWK). IETF; May 2015. https://www.rfc-editor.org/rfc/rfc7517
- Josefsson S, Liusvaara I. RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA). IETF; January 2017. https://www.rfc-editor.org/rfc/rfc8032
- NIST. FIPS 203: Module-Lattice-Based Key-Encapsulation Mechanism Standard (ML-KEM). 2024. https://csrc.nist.gov/pubs/fips/203/final
- NIST. FIPS 204: Module-Lattice-Based Digital Signature Standard (ML-DSA). 2024. https://csrc.nist.gov/pubs/fips/204/final
Pick up where you left off
Stored only in this browser — never sent to our servers.