Generate an RSA or EC key pair in your browser with WebCrypto and export the public and private keys as PEM or JWK. Keys never leave your device.
Keys are generated locally in your browser — the private key is never uploaded.
— output appears here —
— output appears here —
About this tool
The RSA / EC Key-Pair Generator creates an asymmetric key pair entirely in your browser using the native WebCrypto API (crypto.subtle.generateKey), then exports it in the formats you actually paste into config files and code. Nothing is transmitted or stored on a server: the private key is generated on your device, shown once, and discarded when you leave the page. This makes it a safe way to mint keys for SSH-adjacent tooling, JWT signing, TLS experiments, or learning how public-key formats fit together.
For RSA you choose a modulus length of 2048, 3072, or 4096 bits with the standard public exponent 65537, and whether the key is for signing (RSASSA-PKCS1-v1_5, SHA-256) or encryption (RSA-OAEP, SHA-256). For elliptic-curve keys you pick a NIST curve — P-256, P-384, or P-521 — and whether it is for signing (ECDSA) or key agreement (ECDH). Larger RSA moduli and higher curves are stronger but slower to generate; RSA-4096 in particular can take a few seconds in-browser.
Export is done with WebCrypto's exportKey: the public key as SubjectPublicKeyInfo (SPKI) and the private key as PKCS#8, base64-encoded and wrapped at 64 characters per line inside -----BEGIN PUBLIC KEY----- / -----BEGIN PRIVATE KEY----- frames. Switch the format toggle to JWK to get the JSON Web Key representation instead. Because generation is local and offline, the private key is never uploaded — copy it somewhere safe before closing the tab, as it cannot be recovered afterwards.
Frequently asked questions
Are the private keys sent to a server?
No. Keys are generated locally by your browser's WebCrypto engine and exported in-page. The private key never leaves your device and is not stored anywhere, so copy it somewhere safe before closing the tab — it cannot be recovered afterwards.
Which key size or curve should I pick?
RSA-2048 is the common baseline; 3072 or 4096 give more margin at the cost of slower generation and larger keys. For EC, P-256 is fast and widely supported, while P-384 and P-521 offer higher security levels. EC keys are much smaller than RSA for comparable strength.
What is the difference between the PEM and JWK output?
PEM is the base64 DER format wrapped in BEGIN/END lines that most servers and OpenSSL expect — SPKI for the public key and PKCS#8 for the private key. JWK is the JSON Web Key object used by JavaScript and JOSE/JWT libraries. Both describe the same key pair.
Signing versus encryption — what changes?
It selects the algorithm the key is created for. RSA signing uses RSASSA-PKCS1-v1_5 and encryption uses RSA-OAEP; EC signing uses ECDSA and key agreement uses ECDH. A key generated for one purpose is bound to that algorithm, so choose based on how you will use it.