toolqik

39 · Keys & Auth

RSA Key Pair Generator

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

Runs in your browser
Key size
Format
Private key (keep secret)

  
Public key

  
OpenSSH public key

  

About this tool

RSA is the most widely supported public-key algorithm: TLS certificates, JWT signing (RS256), SSH, code signing and encryption all use it. This generator creates an RSA key pair in the standard formats that OpenSSL, Node.js, Python, Java and cloud services read: the private key as PKCS#8 PEM (-----BEGIN PRIVATE KEY-----), the public key as SPKI PEM (-----BEGIN PUBLIC KEY-----), or both as JSON Web Keys.

Keys are generated by your browser’s Web Crypto API and never leave this page: nothing is uploaded, logged or stored. For production servers, generating keys on the machine that will use them (with openssl or ssh-keygen) is still best practice.

Which key size?

  • 2048 bits: the minimum accepted today, and fine until about 2030 according to NIST.
  • 3072 bits: about 128-bit security; recommended for keys that must stay safe beyond 2030.
  • 4096 bits: more margin, but slower to sign and generate. Generation can take several seconds.

For new signing keys where you control both ends, Ed25519 is faster and smaller with strong security. Choose RSA when you need the widest compatibility.

Using the keys

# Inspect the private key
openssl pkey -in private.pem -text -noout

# Derive the public key from the private key
openssl pkey -in private.pem -pubout -out public.pem

# Sign a JWT with RS256 (Node.js, npm install jose)
const key = await importPKCS8(privatePem, 'RS256');
const jwt = await new SignJWT({ sub: '42' }).setProtectedHeader({ alg: 'RS256' }).sign(key);

Store the private key in a secret manager or a file readable only by the service that needs it (chmod 600). Share only the public key.

FAQ

How do I generate an RSA key pair?

Pick a key size and click Generate. You get a private key and a public key in PEM format, ready to save or copy.

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

PKCS#1 (BEGIN RSA PRIVATE KEY) is RSA-only; PKCS#8 (BEGIN PRIVATE KEY) works for any algorithm and is the modern default. Convert with openssl pkey -in key.pem -traditional if a tool needs PKCS#1.

Which RSA key size should I use?

2048 bits is the minimum; 3072 bits is recommended for long-lived keys. 4096 bits adds margin at the cost of speed.

Is it safe to generate keys in a browser?

The key is created by the browser’s Web Crypto API and never leaves your device. For production servers, generating keys locally with OpenSSL is still the safest practice.

esc
↑↓ navigate↵ open