AnyTool
Your files never leave your device. All processing happens locally in your browser.

How do I generate an RSA key pair in my browser?

Pick a purpose — signing (RSASSA-PKCS1-v1_5 or RSA-PSS) or encryption (RSA-OAEP) — a hash (SHA-256/384/512) and a modulus size (2048, 3072 or 4096-bit), then generate. The browser’s native Web Crypto API (crypto.subtle.generateKey) mints a real key pair using the operating-system CSPRNG, and the tool exports the public key as SPKI PEM and the private key as PKCS #8 PEM, plus both as JWK, with a SHA-256 fingerprint of the public key. Everything runs on your device — the private key is never uploaded.

  • Choose signing (PKCS#1 v1.5 / PSS) or encryption (OAEP), a hash, and 2048 / 3072 / 4096 bits
  • Real keys via crypto.subtle.generateKey with the OS CSPRNG — never Math.random
  • Public key as SPKI PEM + JWK; private key as PKCS #8 PEM + JWK, each copyable and downloadable
  • Public exponent is the standard F4 65537; SHA-256 fingerprint of the SPKI DER shown
  • 100% client-side — nothing is uploaded; keep the private key secret

What is

RSA key pair

An RSA key pair is a matched public and private key for the RSA public-key cryptosystem (RFC 8017 / PKCS #1). The public key can be shared and is used to verify signatures or encrypt data; the private key is kept secret and is used to sign or decrypt. In this tool the pair is generated entirely in the browser by the Web Crypto API (crypto.subtle.generateKey), which sources randomness from the operating-system CSPRNG. The public key is exported in SubjectPublicKeyInfo (SPKI, RFC 5280) form and the private key in PKCS #8 (RFC 5958) form, each wrapped as base64 PEM (RFC 7468) or serialised as a JSON Web Key (JWK, RFC 7517), with the standard F4 public exponent 65537.

Security & Privacy

Related terms

RSApublic-key cryptographyRSASSA-PKCS1-v1_5RSA-PSSRSA-OAEPSPKIPKCS #8PEMJWKpublic exponent 65537moduluskey fingerprintWeb Crypto APIECC / Ed25519

Frequently Asked Questions

Entirely in your browser. The Web Crypto API mints the pair with the OS CSPRNG, and nothing — especially the private key — is ever uploaded.

This tool is 100% client-side. The key pair is produced by the browser’s native crypto.subtle.generateKey, which draws entropy from the operating-system cryptographically secure random generator, and every representation (SPKI PEM, PKCS #8 PEM, JWK and the SHA-256 fingerprint) is computed locally. There is no server, no upload, no CDN in the crypto path and no telemetry. The keys exist only in this browser tab until you copy or download them, and closing the tab discards them. The only optional network use anywhere on the site is consent-gated ads, which never see your keys.

2048-bit is the minimum today (~112-bit security, fine through about 2030). Use 3072-bit for long-term keys; 4096-bit is strongest but slower.

NIST puts the floor at 2048-bit RSA, which provides roughly 112-bit security and is acceptable through about 2030. For keys that must stay secure well beyond that, choose 3072-bit (~128-bit security) or higher; 4096-bit is stronger still but noticeably slower to generate and to use. For most new systems, elliptic-curve keys (ECDSA / Ed25519) give equivalent security with much smaller, faster keys, so consider those too. Whatever you pick, the security also depends on keeping the private key secret and on how the key is stored.

Signing keys (RSASSA-PKCS1-v1_5 or RSA-PSS) prove authenticity; encryption keys (RSA-OAEP) protect data for the key owner. One RSA pair is generated for one job.

Web Crypto assigns fixed usages to an RSA key, so you generate a pair for one purpose. A signing key gets the usages sign and verify: you sign with the private key and anyone verifies with the public key — RSA-PSS is the modern, randomized, provably secure scheme, while RSASSA-PKCS1-v1_5 is the older deterministic one that is maximally compatible. An encryption key gets encrypt and decrypt: others encrypt to your public key and only your private key decrypts — RSA-OAEP is the recommended padding. RSA can only encrypt small payloads, so real systems usually encrypt a random symmetric key with RSA and the data with AES (hybrid encryption).

These are real keys and never leave your browser, but a browser tab is not an HSM. For production, prefer OpenSSL, ssh-keygen or a managed HSM / KMS.

The keys here are genuine and generated locally with the platform CSPRNG, which makes the tool great for testing, learning, JWT signing keys and side projects. But a browser tab is not a hardware security module: a compromised device, a malicious extension or a cross-site-scripting flaw could in principle read a key from memory, and the exported PKCS #8 private key is unencrypted. For high-stakes production keys, generate them with your platform’s own tooling (openssl, ssh-keygen) or inside a managed HSM / KMS so the private key is created and stored where it never touches a browser, add a passphrase before storing it, and rotate immediately if it is ever exposed.

Detailed Explanation

How It Works

What the RSA Key Generator Is

The RSA Key Generator is a 100% client-side tool that mints a real RSA public/private key pair in your browser. You choose what the pair is for — signing (RSASSA-PKCS1-v1_5 or RSA-PSS) or encryption (RSA-OAEP) — a hash (SHA-256/384/512) and a modulus size (2048, 3072 or 4096-bit), and the browser’s native Web Crypto API generates the pair using the operating-system CSPRNG. It then exports the public key as SubjectPublicKeyInfo (SPKI) PEM and the private key as PKCS #8 PEM, plus both as JSON Web Keys (JWK), and shows a SHA-256 fingerprint of the public key. It is a convenience / testing generator, not a key-management system.

  • Generates a genuine RSA key pair entirely in the browser
  • Purpose: signing (PKCS#1 v1.5 / PSS) or encryption (OAEP)
  • Modulus 2048 / 3072 / 4096-bit; hash SHA-256 / 384 / 512
  • Public key as SPKI PEM + JWK; private key as PKCS #8 PEM + JWK
  • Public exponent is the standard F4 65537
Methodology

How the Key Pair Is Generated and Exported

On generate, the tool calls crypto.subtle.generateKey with an RsaHashedKeyGenParams object — the resolved algorithm name (RSASSA-PKCS1-v1_5, RSA-PSS or RSA-OAEP), the chosen modulusLength, a public exponent of 65537 (0x010001) and the chosen hash — marking the pair extractable so it can be exported. It then exports the public key with format “spki”, the private key with format “pkcs8”, and both keys with format “jwk”. The binary SPKI and PKCS #8 DER buffers are base64-encoded and wrapped into 64-column PEM blocks (RFC 7468), and the JWKs are pretty-printed as JSON. Finally it hashes the SPKI DER bytes with SHA-256 to produce a fingerprint, shown as OpenSSH-style SHA256:base64 and as colon-separated hex.

  • crypto.subtle.generateKey with modulusLength + publicExponent 65537 + hash
  • exportKey(“spki”) and exportKey(“pkcs8”) → DER → base64 → PEM (RFC 7468)
  • exportKey(“jwk”) for both keys, serialised as JSON
  • Fingerprint = SHA-256 of the SPKI DER (SHA256:base64 and colon hex)
  • A 2048-bit key pair mints on first load; Regenerate applies changed options
Technical Details

The Cryptography in Detail

All key generation uses the browser’s native Web Crypto API (window.crypto.subtle), whose RSA key generation draws primes from the operating-system CSPRNG — never Math.random. The schemes follow RFC 8017 (PKCS #1 v2.2): RSASSA-PSS is randomized and provably secure and is recommended for new signatures; RSASSA-PKCS1-v1_5 is deterministic and maximally compatible with no known practical break; RSA-OAEP is the recommended encryption padding, superseding the Bleichenbacher-vulnerable PKCS#1 v1.5 encryption. The public key format is SubjectPublicKeyInfo (RFC 5280) and the private key format is PKCS #8 (RFC 5958). Key strength is roughly 112-bit for 2048-bit, 128-bit for 3072-bit and more for 4096-bit moduli; RSA can only encrypt payloads smaller than the modulus, so real systems use hybrid encryption (RSA wraps a random AES key).

  • Web Crypto RSA keygen sources primes from the OS CSPRNG (never Math.random)
  • RFC 8017: RSA-PSS / RSA-OAEP preferred over the older PKCS#1 v1.5 schemes
  • SPKI = RFC 5280 public key; PKCS #8 = RFC 5958 private key
  • 2048≈112-bit, 3072≈128-bit security; larger moduli are slower
  • RSA encrypts small data only → real use is hybrid (RSA + AES)
Limitations

Honest Limitations

These are real keys, but this is a convenience / testing generator, not a key-management system. Keep the private key secret: anyone who obtains it can impersonate you (signing) or decrypt your data (encryption). A browser tab is not a hardware security module — a compromised device, a malicious extension or a cross-site-scripting flaw could read a key from memory — and the exported PKCS #8 private key is unencrypted, so add a passphrase with your own tooling before storing it. For production keys, prefer your platform’s tooling (openssl, ssh-keygen) or a managed HSM / KMS so the private key is created and stored where it never touches a browser. On the algorithm itself, 2048-bit is the floor today; use 3072+ for long-term keys, prefer RSA-PSS and RSA-OAEP for new work, and consider ECC / Ed25519, which give equivalent security with smaller, faster keys.

  • Convenience / testing tool, not a key-management system
  • Private key is secret; a browser tab is not an HSM
  • Exported PKCS #8 is unencrypted — add a passphrase before storing
  • Production: use openssl / ssh-keygen or an HSM / KMS
  • 2048-bit is the floor; consider 3072+ or ECC / Ed25519
Privacy & Security

Private by Design

Everything happens on your device. The key pair is generated by the Web Crypto API using the operating-system CSPRNG, and the private key, public key, PEM, JWK and fingerprint are all computed locally. Nothing is fetched, uploaded, logged or stored on a server, there is no CDN in the crypto path and no telemetry, and the keys exist only in the tab until you copy or download them — closing the tab discards them. The private-key panel is warning-styled and blurred until you explicitly reveal it, reducing the chance of leaking it by accident. The tool works offline once cached, supports dark mode and a mobile-first layout, and the only optional network use anywhere on the site is consent-gated ads, which never see your keys.

  • Keys generated locally via Web Crypto; nothing uploaded
  • No server, no CDN in the crypto path, no logging, no telemetry
  • Keys exist only in the tab; closing it discards them
  • Private-key panel blurred until you reveal it
  • Works offline once cached; dark-mode and mobile-first
RSA key options and what each choice means
ChoiceValueNotes
Signing schemeRSA-PSSRandomized, provably secure — preferred for new signatures
Signing schemeRSASSA-PKCS1-v1_5Deterministic, maximally compatible; no known practical break
EncryptionRSA-OAEPRecommended padding; supersedes PKCS#1 v1.5 encryption
2048-bit≈112-bit securityMinimum today — acceptable through about 2030
3072-bit≈128-bit securityRecommended for long-term keys
4096-bit≈140-bit+ securityStrongest; noticeably slower to generate and use
Public exponent65537 (F4)Standard exponent for interoperability and speed

RSA is larger and slower than ECC / Ed25519 — consider those for new systems. Keys are generated locally in your browser and never uploaded. As of July 2026.