RSA Key Pair Generator
RSA Key Pair Generator
Generate 2048/3072/4096-bit RSA keypairs in PEM and JWK formats, in-browser.
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 and 3072-bit at 128 bits; 3072 is the default here. A bigger key does not extend RSA's NIST timeline: NIST IR 8547 deprecates RSA signatures at 112-bit security and above, which covers every size this page offers, after 2030 and disallows them after 2035. The hash you pick is recorded only in the JWK's alg field (RS256, RS384 or RS512); the PEM keys are the same whichever you choose.
Click Generate
The browser's Web Crypto API finds the two primes, and the page then shows the time it took on your device. The time varies with the device and with luck in the prime search. As one measurement on one setup (Web Crypto in Node.js 26.13 on an Apple M4 Mac, 25 Nov 2026, 15 runs per size), the median 4096-bit key took about 310 ms, with single runs from 39 to 833 ms.
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.
How an RSA key pair is built, sized and stored
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. NIST sets RSA's end dates in NIST IR 8547 (October 2026), which lists RSA among the quantum-vulnerable signature algorithms and says that "NIST will instead deprecate all quantum-vulnerable digital signature algorithms after 2030 and disallow their use under NIST standards and guidelines after 2035." That applies to RSA at 2048 bits and above, and to ECDSA and EdDSA too. It replaces the earlier SP 800-57 projection, under which only 112-bit keys such as RSA-2048 had an end date. This page defaults to 3072 for its 128-bit strength, not for a longer life.
"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. The small exponent e = 3 falls below the FIPS 186-5 lower bound.
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 format, and this page makes RSA keys only, so it is not an SSH key generator; if you need one of these keys in OpenSSH form, ssh-keygen -i -m PKCS8 -f public.pem turns the public PEM into an ssh-rsa line, and ssh-keygen -y -f private.pem prints the same line from the PKCS#8 private key.
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 published three post-quantum standards on 13 August 2024: ML-KEM for key establishment (FIPS 203), and ML-DSA (FIPS 204) and SLH-DSA (FIPS 205) for signatures, 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.
NIST IR 8547 deprecates RSA signatures after 2030 and disallows them after 2035 at 112-bit security and above, which covers all three sizes offered here.
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 three post-quantum standards, all published on 13 August 2024, are ML-KEM (FIPS 203), ML-DSA (FIPS 204) and SLH-DSA (FIPS 205).
The hash you pick changes only the JWK's alg field (RS256, RS384 or RS512); the PEM keys carry no hash.
Frequently asked questions
Method & sources
How it computes
RSASSA-PKCS1-v1_5 key pair from the browser's Web Crypto API at 2048, 3072 or 4096 bits with e = 65537, exported as SPKI and PKCS#8 PEM and as JWK; the signing hash sets only the JWK alg (RS256, RS384, RS512). The page reports the reader's own generation time in milliseconds. Clear wipes the key text from the page. RSA keys only.
What this tool implements
- The public exponent is e = 65537: FIPS 186-5 requires an odd e with 2^16 < e < 2^256. Key-size labels follow SP 800-57 Part 1 Rev. 5 Table 2: 2048 bits = 112-bit security, 3072 = 128-bit; 15360 for 256-bit.
- NIST IR 8547 (October 2026) Table 2: RSA, ECDSA and EdDSA signatures are "Deprecated after 2030" and "Disallowed after 2035". NIST "will instead deprecate all quantum-vulnerable digital signature algorithms after 2030 and disallow their use under NIST standards and guidelines after 2035", replacing SP 800-57's earlier projection for 112-bit keys. A larger RSA key does not change those dates.
- Post-quantum standards are named as NIST published them on 13 August 2024: ML-KEM (FIPS 203), ML-DSA (FIPS 204) and SLH-DSA (FIPS 205). Ed25519's ~128-bit security level is from RFC 8032.
- The public PEM converts to an OpenSSH ssh-rsa line with ssh-keygen -i -m PKCS8, and ssh-keygen -y reads the PKCS#8 private key directly; checked on 25 Nov 2026 with OpenSSH 10.6p2 on a key from the same Web Crypto call and export formats. The page makes RSA keys only, not SSH keys of other types.
- Timing: the page reports the reader's own time. The one reference it prints was measured on 25 Nov 2026 with Web Crypto in Node.js 26.13 on an Apple M4 Mac, 15 runs per size: the 4096-bit median was about 310 ms, single runs 39 to 833 ms.
Sources
- Moody D, Perlner R, Regenscheid A, Robinson A, Cooper D. NIST IR 8547: Transition to Post-Quantum Cryptography Standards (Table 2, §4.1.1). NIST; October 2026. https://csrc.nist.gov/pubs/ir/8547/final
- Barker E. NIST SP 800-57 Part 1 Rev. 5: Recommendation for Key Management (Table 2). 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