RSA Key Pair Generator
Generate RSA key pairs in PEM format
What is RSA Key Pair Generator?
This RSA key pair generator uses the browser Web Crypto API to create 2048-, 3072-, or 4096-bit keys and outputs PEM text for the SPKI public key and the PKCS#8 private key, with a choice between signing and encryption usage. Generation happens locally and the private key is never uploaded.
How to use RSA Key Pair Generator
- 1Choose a key size — 2048 bits is the current practical minimum.
- 2Choose a purpose: signing and verification (RSASSA-PKCS1-v1_5) or encryption (RSA-OAEP).
- 3Click "Generate key pair"; it finishes within a few seconds.
- 4Copy and store the public and private keys separately, keeping the private key protected.
How do I do this in code?
Use the tool above for one-off work; for anything you repeat, move it into a script or your project.
# Generate a private key openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out private.pem # Derive the public key from it openssl rsa -in private.pem -pubout -out public.pem
Frequently asked questions
Is it safe to generate RSA keys in a browser?+
The generation itself uses the browser cryptographic random source and its vetted algorithm implementation, and the key never leaves the page. That said, production keys should be generated on a controlled host and moved straight into a key management system, so they never pass through a clipboard or a chat window. This tool is meant for testing and debugging.
Is 2048-bit RSA still strong enough?+
It remains the mainstream minimum and the baseline most compliance regimes require. If the key needs a long service life — say beyond five years — go straight to 3072 bits. When you want strength without the performance cost, elliptic curve keys (Ed25519 or P-256) are the more modern choice.
Can I use one key pair for both signing and encryption?+
You should not. The two purposes use different padding schemes (PKCS#1 v1.5 versus OAEP), sharing a key weakens security, and in some protocols it opens up additional attack surface. Generating separate keys per purpose, as this tool does, is the correct approach.
Related tools
All toolsBase64 Encoder & Decoder
Encode and decode Base64, with UTF-8 and URL-safe support
File to Base64
Convert files to Base64 and data URIs — nothing is uploaded
URL Encoder & Decoder
Percent-encode URLs, with separate modes for full URLs and parameter values
HTML Entity Encoder
Escape and unescape HTML entities
Hex to Text Converter
Convert between text and hex with several separator styles
Unicode Escape Converter
Escape and unescape Unicode in three notations