File & privacy

RSA Key Generator

RSA Key Generator

RSA 2048, 3072 or 4096-bit key pairs as PEM, JWK or OpenSSH, generated locally.

About this tool

About RSA Key Generator

Generate an RSA public and private key for TLS testing, JWT RS256 signing, encrypting with RSA-OAEP or legacy SSH access. It opens on RSA 4096 in PEM format: the public key as SPKI (BEGIN PUBLIC KEY) and the private key as unencrypted PKCS#8 (BEGIN PRIVATE KEY), the same output as openssl genpkey, readable by OpenSSL, Node.js crypto, Java, Go and Python's cryptography package. Switch to 2048 or 3072 bits for faster operations, or export as JWK for JOSE libraries or OpenSSH for authorized_keys. Every key uses the public exponent 65537. Large keys take a few seconds because the browser must find two random primes; the button shows when it is working. Generation runs in your browser's Web Crypto implementation with the operating system's secure random source, so the private key never touches a network. For new systems consider Ed25519 or ECDSA P-256, which are faster and shorter at equal strength.

Built and maintained by Abhi JainUpdated

How to Generate an RSA Key Pair

  1. 1

    Choose the size

    RSA 4096 is selected. Pick RSA 2048 or RSA 3072 if you need faster signing or smaller keys.

  2. 2

    Choose the format

    Keep PEM for OpenSSL and most libraries, or switch to JWK or OpenSSH.

  3. 3

    Save the keys

    Download public.pem and private.pem. Click Generate new key pair for another key.

RSA Key Generator: questions and answers

Which RSA key size should I use?

3072 bits gives about 128-bit security and is the NIST recommendation beyond 2030. 2048 is still the minimum accepted today; 4096 is stronger but slower to generate and use.

Why does RSA 4096 take so long?

Generating RSA means searching for two large random primes, which takes many trial tests. A 4096-bit key can take several seconds in a browser; elliptic-curve keys are instant.

Can I use this key for encryption as well as signing?

Yes. The key material is the same; it is tagged RS256 in JWK, but you can import the PEM for RSA-OAEP encryption or RSA-PSS signatures in your library. Use separate keys for signing and encryption in production.

What is the difference between PKCS#1 and PKCS#8?

PKCS#1 (BEGIN RSA PRIVATE KEY) is RSA-only; PKCS#8 (BEGIN PRIVATE KEY) wraps any key type with an algorithm identifier. Convert with openssl pkey -in private.pem -traditional if a tool needs PKCS#1.

More Key Pair Generator presets