RSA Key Pair Generator

Choose the algorithm and the key size, then make a pair. The private key is shown as PKCS#8 PEM and as JWK, the public key as SPKI PEM and as JWK. Copy or download each one.

Free Runs in your browser Checked Tuesday, November 10, 2026

This tool runs in your browser. What you enter is not sent to us.

How to use it

  1. Choose the Algorithm: RSA-OAEP to encrypt, or one of the signature algorithms.
  2. Choose the Key size. 2048 bits is the usual minimum; 4096 bits takes longer to make.
  3. Press Make key pair, then copy or download the four boxes.
  4. Store the private key in a secrets manager, and never paste it into a website, a chat or a file that others can read.

What the key pair holds

An RSA key pair has a public part, which anyone may have, and a private part, which only its owner keeps. The private key is written as PKCS#8 (RFC 5958), the public key as SubjectPublicKeyInfo (RFC 5280). Both are wrapped in PEM, the Base64 text between BEGIN and END lines (RFC 7468). The JWK form (RFC 7517) holds the same numbers as JSON.

modulus n = p x q, two primes of about half the key size each
public exponent e = 65537 (0x010001)
private exponent d, with d x e = 1 modulo (p - 1) x (q - 1)

Algorithm and key size

RSA-OAEP encrypts and RSA-PSS and RSASSA-PKCS1-v1_5 sign. All three use SHA-256 here. The key size is the length of the modulus n: 2048 bits is the usual minimum today, 3072 and 4096 bits are for keys that must last longer. A larger key is slower to use, but the public key of a 4096-bit pair is still small.

The browser makes the pair with its own cryptographic library (crypto.subtle.generateKey in the Web Cryptography API). The page does not write its own RSA code.

Where the keys are safe, and where they are not

The keys never leave this page: they are not sent, stored or logged. The risk is the page itself. Anything running in this page, and any extension in the browser, can read a key while it is shown, and a copy in the clipboard or a download stays on the disk until it is deleted.

For a key that protects money, an identity or a production system, generate it where the private key cannot be copied out: in a hardware security module, a key vault or a server you control.

Worked example: a 2048-bit RSA-OAEP pair

Choosing RSA-OAEP and 2048 bits, then pressing Make key pair, gives a PKCS#8 private key whose PEM begins with -----BEGIN PRIVATE KEY----- and an SPKI public key whose PEM begins with -----BEGIN PUBLIC KEY-----. The JWK of the public key has kty RSA and e AQAB, which is the Base64url of 65537. Its n value is 256 bytes long, because 2048 bits are 256 bytes.

Frequently asked questions

Is it safe to make a key for a real website in this page?

For learning and tests, yes. For keys that protect money, identities or a live system, no: the browser and its extensions can read a key while it is shown. Make such keys where the private key cannot be copied out.

Why is the private key in PKCS#8 and not in the older RSA PRIVATE KEY format?

PKCS#8 (RFC 5958) names the algorithm inside the key, so a reader knows what the key is for. Most libraries accept it. If yours wants the older form, convert it with a tool such as openssl.

Why is the public exponent 65537?

It is 2 to the power 16 plus 1, a small number with only two bits set. It makes the public operation fast and is the value that mainstream libraries use, so the page uses it for every key.

Should I choose 2048, 3072 or 4096 bits?

2048 bits is the usual minimum today. Choose 3072 or 4096 when the key must stay secure for many years, and accept that signing or decrypting takes longer with a larger key.

Why is the private key so much longer than the public key?

The public key holds only the modulus and the public exponent. The private key also holds the two primes and the values that speed up decryption (RFC 8017, appendix A.1.2), so it is several times longer.

Does the page keep my keys after I close it?

No. The keys exist only in the memory of the open page, and the page stores nothing in the browser, not even in local storage. Copy or download the keys before you close it.

Sources

Figures and text last checked on Tuesday, November 10, 2026.

We use necessary cookies to run the site. With your consent, Google also uses advertising cookies to show personalised ads. If you reject them, you still see ads, but they are not personalised.