Skip to content

RSA Key Pair Generator

Generate an RSA key pair in your browser and export it as PKCS#8 / SPKI PEM or JWK. The private key never leaves the page.

Private key

Public key

The private key was generated in this page and is not stored anywhere. Copy it now — closing the tab loses it, and anyone who obtains it can sign as you.

Key pairs generated on your device

The pair is generated with `crypto.subtle.generateKey` and exported here directly. There is no request to a server, which is the only acceptable arrangement for a private key — a key that was ever transmitted to generate it is a key you cannot trust.

Nothing is stored either. Close the tab and the private key is gone, so copy it before you navigate away.

  • PEM — the `-----BEGIN PRIVATE KEY-----` form, PKCS#8 for the private half and SPKI for the public half. This is what OpenSSL, nginx and most libraries expect.
  • JWK — the JSON form used by JOSE, OIDC and Web Crypto itself. This is what a `/.well-known/jwks.json` endpoint serves.

RSA or elliptic curve

An ECDSA P-256 key gives roughly the security of a 3072-bit RSA key, in about a tenth of the size, and signs far faster. Prefer it for anything new.

RSA remains the safer bet for interoperability: some older systems, hardware modules and enterprise PKI still accept nothing else.

Frequently asked questions

Are these keys really generated locally?

Yes. The page makes no network requests at all — you can disconnect and generate a pair. That is verifiable in your browser's network panel.

What key size should I use?

RSA 2048 is the current minimum and is fine for most uses; 3072 or 4096 for keys with a long life. For elliptic curve, P-256 unless something specifies otherwise.

Why does my server reject the private key?

It probably wants PKCS#1 ("BEGIN RSA PRIVATE KEY") rather than the PKCS#8 exported here. Convert with: openssl pkcs8 -topk8 -nocrypt -in pkcs8.pem -out pkcs1.pem

Should I use this for a production key?

For test and development keys, and for JWT signing keys you will store in a secret manager, yes. For a CA or an HSM-backed key, generate it where it will live instead.

Related tools