RSA Key Pair Generator

Share:

Generate 2048/3072/4096-bit RSA keypairs in PEM and JWK formats — entirely in your browser via SubtleCrypto.

RT-CW3-003 · Crypto & Web3

RSA Key Pair Generator

Privacy: Key generation runs entirely in your browser via the W3C SubtleCrypto API. The private key never leaves this page. We recommend you generate keys only for non-production use here; for production keys, use ssh-keygen, openssl, or a hardware security module.
Click "Generate keypair" — 4096-bit keys take 15-30 seconds in browser.
Advertisement
After results · AD-W1 Responsive · Post-tool — peak engagement

How to use the RSA key pair generator

Pick a key size

2048 bits is the minimum we'd recommend in 2026 (still acceptable, fast to generate). 3072 bits is the modern default — equivalent to AES-128 security strength. 4096 bits is overkill for most cases but used in long-lived signing keys.

Click Generate

For 2048 bits the operation takes about a second. 3072 bits takes roughly 3 seconds. 4096 bits in browser can take 15-30 seconds — your tab will be unresponsive for that period. The browser's SubtleCrypto runs this in optimised native code, not JavaScript.

Copy or download the keys

Four output formats: PEM (the standard openssl/ssh format), JWK (for JWT, JOSE, web apps). PEMs are ready to paste into config files or save as .pem files. Always store the private key with restricted file permissions (chmod 600).

Use, then rotate

Use the keypair for testing, learning, or non-critical applications. For production use, generate keys with ssh-keygen or openssl on a secure machine — and rotate them on a schedule (yearly for SSH, sooner for high-value signing keys).

Advertisement
After how-to · AD-W2 Responsive

RSA — the algorithm behind half the world's TLS

RSA, named after Rivest, Shamir, and Adleman who published it in 1977, is one of the most-deployed asymmetric cryptographic algorithms in history. Almost every TLS handshake from 1995 to 2018 used RSA for key exchange; even today, with elliptic-curve alternatives like ECDSA and Ed25519 ascendant, RSA still backs a huge share of CA certificates, code-signing keys, SSH host keys, JWT signatures, and S/MIME email. Its security rests on the difficulty of factoring the product of two large primes — a problem that has stayed hard despite four decades of research, even with advances in number-field-sieve algorithms.

Key sizes — what's safe today, what's safe in 2030

The minimum RSA key size considered cryptographically sound in 2026 is 2048 bits. Below that (1024 and lower) the work factor for an academic factoring attack has dropped to the point where well-funded adversaries can reasonably attempt it. 2048-bit keys remain safe against any publicly-known attack and will likely stay so through the late 2020s; 3072-bit keys are equivalent to 128-bit symmetric security strength per NIST guidance and are the recommended default for new deployments today. 4096-bit keys offer a comfortable margin for long-lived signing keys (CA roots, S/MIME identities held for years) but are overkill for ephemeral TLS keys rotated every 90 days via Let's Encrypt.

PEM, DER, OpenSSH, and JWK — same key, different wrappers

An RSA keypair is mathematically just a pair of large integers (modulus and private exponent). The format wrappers serve different ecosystems. DER is the canonical binary encoding (ASN.1 SEQUENCE of integers). PEM is DER base64-encoded with -----BEGIN/END labels — the format you'll see in /etc/ssl/private/ on every Linux server. OpenSSH format is a different wire format used in ~/.ssh/id_rsa with its own header structure. JWK (JSON Web Key, RFC 7517) is a JSON object with the key components as base64url-encoded fields — used by every JWT library, the JOSE spec family, and OAuth/OIDC /jwks.json endpoints. All four contain the same mathematical material; conversion between them is mechanical.

Why ECDSA and Ed25519 are taking over

RSA's main weakness is verbosity. A 256-bit Ed25519 key has the same security level as a 3072-bit RSA key — twelve times shorter to transmit and several times faster to sign with. TLS 1.3 explicitly prefers elliptic-curve cipher suites; modern SSH installs default to Ed25519 when you run ssh-keygen without arguments; the JOSE spec includes EdDSA alongside RS256. RSA persists because it's universally supported (every embedded device, every legacy system, every CA), well-understood, and "good enough" — but for new keys with no legacy constraints, Ed25519 or ECDSA-P-256 are the better default. We will ship an Ed25519 generator as a separate tool in a future update.

Don't paste production private keys into web tools

A consistent piece of advice from every security review: do not paste production private keys into any browser-based tool, including this one. The reasoning is identical to the TOTP-secret warning — once a private key sits in your tab's JavaScript heap, it is accessible to any malicious browser extension, any XSS bug, and any data-stealing malware on your machine. For test keys, learning, integration verification, or developer experimentation: this tool is fine. For real keys protecting real assets, use a workstation-local tool (ssh-keygen, openssl genrsa), a password manager with key-storage features (1Password, Bitwarden), or a hardware security module (YubiKey, AWS CloudHSM, GCP Cloud HSM, AlibabaCloud KMS).

10 RSA and asymmetric crypto facts

01

RSA was published in 1977 by Rivest, Shamir, and Adleman at MIT. The algorithm had actually been discovered earlier (1973) by Clifford Cocks at GCHQ but was classified British government secret until 1997.

02

The public exponent 65537 (also written F4 or 0x10001) is the de-facto standard. It's a Fermat prime giving fast modular exponentiation while being large enough to defeat low-exponent attacks.

03

The largest RSA modulus ever publicly factored is RSA-260 (829 bits / 250 decimal digits), factored in 2020 over 2,700 core-years on Intel Xeon Gold CPUs. RSA-2048 remains comfortably beyond reach.

04

NIST SP 800-57 maps 2048-bit RSA to 112-bit symmetric security strength, 3072-bit to 128-bit, and 4096-bit to roughly 152-bit. For 256-bit symmetric strength you\'d need RSA-15360 — impractical.

05

RSA private keys contain a lot more than just the modulus and private exponent — the PKCS#1 format also stores p, q, d mod (p-1), d mod (q-1), and q^(-1) mod p for Chinese-remainder-theorem speedup.

06

RSA signing is slower than RSA verification by a factor of around 100 (typical 3072-bit). This asymmetry is why CAs sign certificates once but clients verify millions of times daily.

07

The W3C SubtleCrypto API was finalised in 2017 and now ships in every major browser. Before then, browser-based RSA generation required JavaScript implementations like Forge or JSEncrypt.

08

SSH was originally designed for RSA-1024 keys in 1995. Modern OpenSSH defaults to Ed25519 since 2014 — 32-byte keys with the security of RSA-3072 and faster everything.

09

The quantum-computing threat: Shor\'s algorithm can theoretically factor RSA in polynomial time on a sufficiently large quantum computer. Estimates suggest practical danger no earlier than 2035-2040.

10

Apple iCloud Keychain, 1Password, and Bitwarden all support RSA private-key storage with PIN-protected access — making them practical alternatives to local .pem files on Mac/iOS.

Frequently asked questions

We do not recommend it. The private key enters your browser's memory and is accessible to any other JavaScript loaded on the page, browser extensions, or malware. For production, use openssl genrsa or ssh-keygen on a hardened workstation, or a hardware security module.
For TLS keys rotated every 90 days (Let's Encrypt etc.), 2048 is fine. For new long-lived keys (SSH, CA, code-signing) 3072 is the modern default. 4096 is overkill for almost everything but useful for very long-lived signing identities.
RSA key generation requires finding two large primes, which involves trial division and Miller-Rabin probabilistic primality testing on candidates. The work scales roughly with the square of the bit length, so 4096-bit takes ~4x as long as 2048-bit.
PEM is the openssl-native format used in TLS, S/MIME, and JWT contexts. OpenSSH format is a different wire encoding specific to ~/.ssh/id_rsa. The same RSA key can be converted between them with ssh-keygen -p or openssl. This tool outputs PEM only — for OpenSSH, run ssh-keygen -m RFC4716.
JSON Web Key (RFC 7517) is a JSON representation of cryptographic keys. Every JWT-signing library and OAuth provider exposes its public keys as JWKs at a /.well-known/jwks.json endpoint. The format is exactly the same RSA key material as PEM, but encoded as a JSON object with named base64url fields.
For locally-stored production private keys, yes. openssl genrsa -aes256 prompts for one. SSH keys are best protected by your password manager rather than a passphrase typed each connection. This tool generates passphrase-less keys; if you need a passphrase, run openssl rsa -aes256 -in private.pem -out encrypted.pem after download.
For any new key with no legacy constraint, Ed25519 is the better default — shorter keys, faster operations, same security level. The exceptions are: TLS server keys on certificate authorities that don't accept Ed25519 yet, S/MIME email signing for old client compatibility, and any system that hardcodes RSA support.
It's one of the two RSA-key parameters. 65537 (0x10001 = F4 Fermat prime) is the de-facto standard — small enough to make encryption/verification fast, large enough to defeat small-exponent attacks. 3 is occasionally seen in old keys and is considered safe with proper padding but discouraged in new keys.
Yes. Once the page loads, key generation runs entirely client-side via the browser's native SubtleCrypto. You can disconnect your network and continue generating keys. Nothing is sent to any server.
Eventually. Shor's algorithm can factor RSA in polynomial time on a sufficiently large fault-tolerant quantum computer. Current estimates suggest practical danger no earlier than 2035-2040. NIST is standardising post-quantum algorithms (Kyber, Dilithium) for transition; keys generated today should plan for migration by 2032.

Related News

You may be interested in these recent stories from our newsroom.

View all news →
Advertisement
Pre-footer · AD-W3 728 × 90

75 more free tools

Calculators, converters, security tools — no signup.