Introduction
Every TLS handshake, every signed JWT, every SSH login starts with a key pair. Generating that pair used to mean firing up OpenSSL on a server and trusting it with your private key. An rsa key generator online removes that step. You pick an algorithm and key size, click generate, and the browser produces a fresh public/private key pair using the same Web Crypto API that powers HTTPS. Nothing leaves your machine. Developers use it to spin up test certificates, students use it to inspect PEM structure, and security engineers use it to prototype signing flows without standing up a CA. Paste nothing in, copy your keys out, and move on.
What this tool does
- Generates RSA key pairs at 2048, 3072, and 4096 bits using node-forge, outputting PKCS#1 PEM.
- Generates ECC key pairs on the P-256, P-384, and P-521 curves using the Web Crypto API, outputting PKCS#8 and SPKI PEM.
- Displays the public key and private key in separate PEM blocks with copy and download buttons for each.
- Shows key metadata including key type (RSA or ECC), key size in bits, and the named curve where applicable.
- Runs entirely client-side. Private keys are generated in the browser and never transmitted to any server.
How this tool works
The tool exposes two algorithms: RSA and ECC. Pick RSA and you choose a bit length (2048, 3072, or 4096). Clicking Generate calls node-forge's forge.pki.rsa.generateKeyPair, which builds the key pair in JavaScript and serializes it with forge.pki.privateKeyToPem and forge.pki.publicKeyToPem. Pick ECC and you choose a named curve (P-256, P-384, or P-521). The tool then calls crypto.subtle.generateKey with the ECDSA algorithm and your curve, exports the private key as PKCS#8 and the public key as SPKI using crypto.subtle.exportKey, and wraps each in a base64 PEM envelope split into 64-character lines. A loading indicator covers the generation window, which can take a few seconds for RSA 4096. The public key tab and private key tab each get their own copy and download buttons, and a metadata card records the key type, size, and curve. Because everything runs in your browser, the private key never touches a network socket.
How RSA and ECC key generation works
RSA, defined in RFC 8017 (PKCS#1 v2.2), relies on the difficulty of factoring the product of two large primes. A 2048-bit key gives roughly 112 bits of security; 3072 bits gives about 128 bits; 4096 bits gives roughly 150 bits. The private key holds the primes p and q plus the private exponent d, while the public key holds the modulus n and exponent e. PEM wrapping for RSA follows the PKCS#1 structure, though many tools also accept the X.509 SubjectPublicKeyInfo form defined in RFC 5280.
Elliptic curve cryptography trades large primes for points on a curve. ECDSA keys, standardized in NIST FIPS 186-5, use curves listed in SP 800-186. P-256 gives about 128 bits of security, P-384 gives 192, and P-521 gives 256. ECC keys are far smaller than RSA keys at equivalent strength: a P-256 public key is 64 bytes versus a 2048-bit RSA public key at 256 bytes. The Web Crypto API exports ECC private keys as PKCS#8 (RFC 5208) and public keys as SPKI, so the PEM headers read -----BEGIN PRIVATE KEY----- and -----BEGIN PUBLIC KEY----- rather than the EC-specific headers some older tools emit.
How to use this tool
- Choose an algorithm: RSA for broad compatibility, or ECC for smaller keys and faster operations.
- If RSA, select a bit length. 2048 is the current minimum; 3072 matches a 128-bit security level; 4096 adds margin for long-lived keys.
- If ECC, select a named curve. P-256 is the default for most TLS deployments; P-384 and P-521 offer higher security levels.
- Click Generate and wait for the loading indicator to clear. RSA 4096 can take several seconds.
- Copy or download the public key and private key from their respective tabs.
- Store the private key somewhere protected. Anyone with the private key can sign or decrypt as you.
Real-world examples
Provisioning a test TLS certificate
A backend developer needs a self-signed certificate for a local HTTPS server. He generates a 2048-bit RSA key pair here, downloads the private key as private-key.pem, then feeds it to OpenSSL with openssl req -new -x509 -key private-key.pem -out cert.pem -days 365. The browser-generated key works because node-forge emits standard PKCS#1 PEM that OpenSSL reads directly.
Creating an ECDSA signing key for JWTs
A team building a microservice wants ES256 signed JWTs, which require a P-256 key. She selects ECC and the P-256 curve, generates the pair, and copies the PEM private key into her service's secret store. The public key goes into the JWKS endpoint as a base64url-encoded SPKI. Because the tool exports SPKI directly, she only needs to strip the PEM headers and base64-decode the body to get the raw key bytes for the JWK.
Comparing RSA and ECC key sizes
A student learning cryptography generates a 3072-bit RSA pair and a P-384 ECC pair, both targeting 128-bit security. He downloads both public keys and checks the file sizes. The RSA public key PEM is roughly 1.6 KB while the ECC public key PEM is under 600 bytes. The difference explains why modern protocols like TLS 1.3 and SSH prefer Ed25519 and ECDSA: smaller keys mean smaller handshakes and less bandwidth.
Comparison with similar methods
| Method | Complexity | Typical use |
|---|---|---|
| RSA 2048 | ~112-bit security, 256-byte key | Legacy TLS, broad compatibility, current minimum |
| RSA 3072 | ~128-bit security, 384-byte key | Matching AES-128 strength, medium-term keys |
| RSA 4096 | ~150-bit security, 512-byte key | Long-lived root keys, extra margin |
| ECC P-256 | ~128-bit security, 64-byte key | Modern TLS, ES256 JWTs, default ECDSA |
| ECC P-384 | ~192-bit security, 96-byte key | Higher-assurance TLS, ES384 JWTs |
| ECC P-521 | ~256-bit security, 132-byte key | High-security environments, ES512 JWTs |
Limitations or considerations
This tool generates keys in your browser and never stores them. If you close the tab without copying or downloading, the keys are gone. RSA generation is synchronous and can freeze the UI for several seconds at 4096 bits. The tool does not create X.509 certificates, certificate signing requests, or PKCS#12 bundles; pair it with OpenSSL for those. ECC keys are exported as generic PKCS#8 and SPKI, not the SEC1 EC-specific format some older libraries expect. Generated keys are for development, testing, and learning. For production systems, use a hardware security module or a managed KMS.
Frequently asked questions
Is it safe to generate production keys in a browser?
For development and testing, yes. For production, prefer a hardware security module or a cloud KMS. Browser-generated keys are fine for short-lived test certificates and JWT signing keys in staging.
Why does RSA 4096 take so long?
RSA key generation requires finding two large primes. At 4096 bits the primality testing is computationally heavy and runs synchronously on the main thread, so the browser can freeze for a few seconds.
What is the difference between PKCS#1 and PKCS#8 private keys?
PKCS#1 (RFC 8017) is RSA-specific and carries the header -----BEGIN RSA PRIVATE KEY-----. PKCS#8 (RFC 5208) is algorithm-agnostic and carries -----BEGIN PRIVATE KEY-----. This tool emits PKCS#1 for RSA and PKCS#8 for ECC.
Which ECC curve should I pick?
P-256 is the default for TLS and ES256 JWTs. P-384 targets 192-bit security for higher-assurance systems. P-521 targets 256-bit security but has less broad library support than P-256.
Are the keys ever sent to a server?
No. RSA generation uses node-forge running locally, and ECC generation uses the Web Crypto API. Both run inside your browser. The private key never leaves your device unless you explicitly copy or download it.
Conclusion
Use this rsa key generator online whenever you need a fresh key pair without installing OpenSSL. Pick RSA for maximum compatibility or ECC for smaller, faster keys at the same security level. Copy the public key, download the private key, and remember that anything generated here is only as safe as where you store it next.