How to use the RSA key pair generator
- Choose the Key size: 2048, 3072 or 4096 bits.
- Choose the Use: Signing — RSASSA-PKCS1-v1_5 / SHA-256 (RS256), Signing — RSA-PSS / SHA-256 (PS256) or Encryption — RSA-OAEP / SHA-256.
- Choose the Format: PEM or JWK.
- Press Generate. Larger keys can take a few seconds.
- Download or copy the public key (
public.pemorpublic.jwk.json) and the private key (private.pemorprivate.jwk.json), and note the fingerprint.
What it does and when to use it
RSA key pairs let one side sign or encrypt and the other side verify or decrypt. Developers need them to sign JSON Web Tokens, to test an OAuth or OpenID Connect setup, to encrypt a secret for one recipient, or to try out a library without touching production keys.
The PEM option gives the standard text blocks: the public key in SPKI form (-----BEGIN PUBLIC KEY-----) and the private key in PKCS#8 form (-----BEGIN PRIVATE KEY-----). Most languages and libraries read both. The JWK option gives JSON objects for JWKS endpoints and JavaScript code.
For symmetric secrets such as AES or HMAC keys, use the encryption key generator. For an API token, the API key generator is simpler. To derive a key from a password, see the PBKDF2 generator.
How it works
The page calls crypto.subtle.generateKey with the chosen algorithm, the modulus length, the public exponent 65537 and SHA-256. The browser’s own cryptography code finds two large random primes and builds the key pair. The keys are exported as SPKI and PKCS#8 (PEM) or as JWK. The fingerprint is a SHA-256 digest of the SPKI bytes. Web Crypto only works on secure pages; if it is missing, the tool shows a message instead.
Worked examples
- Default RS256 key. Size 2048, PEM: the result starts with
-----BEGIN PUBLIC KEY-----, followed by-----BEGIN PRIVATE KEY-----and the statsKey size: 2048 bitsandAlgorithm: RSASSA-PKCS1-v1_5. - Encryption key as JWK. RSA-OAEP, JWK: the public key contains
"alg": "RSA-OAEP-256","kty": "RSA"and"e": "AQAB"(65537 in Base64url). - PS256 at 3072 bits. The stats show
Key size: 3072 bitsandAlgorithm: RSA-PSS, plus a fingerprint such as32:f7:24:b3:….
Limits and tips
- Never commit the private key to a repository or paste it into a ticket.
- Every press of Generate makes a new, unrelated pair. Download both halves before you leave the page.
- The private key file is unencrypted. If you need a passphrase, wrap it with openssl or your key store.
Frequently asked questions
Which key size should I choose?
What is the difference between the three Use options?
Is the private key sent anywhere?
Can I use these keys for SSH or a TLS certificate?
What is the fingerprint for?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.