b2KIT

RSA Key Pair Generator

Generate RSA public/private key pairs with configurable key sizes (2048, 3072, 4096-bit) in PEM format.

Tested tool guide Tested browser tools Checked August 16, 2026

What RSA Key Pair Generator does and how it behaves

An RSA key pair is two large numbers with a one-way relationship: data signed or encrypted with one half is verified or decrypted with the other. Pick a size (2048, 3072, or 4096 bits) and the page generates a new pair from two large random primes, returning both halves as PEM text ready to save into files. The surprise most users hit: every click produces a brand-new, unrelated pair, and nothing can ever regenerate it. If you close the page before saving the private key, the pair is gone and every system trusting the public half must be given a new key.

How the result is produced

1

How the pair is formed

The generator picks two large random primes, multiplies them into a shared modulus, and derives a public exponent (conventionally 65537) plus a matching private exponent from those primes. Both PEM blocks encode that same modulus, which is why the two halves work together. Finding primes is probabilistic and the work grows with key size, so a 4096-bit pair takes noticeably longer to produce than a 2048-bit one.

2

What the PEM text is

PEM is the plain-text envelope most key-consuming software accepts: a BEGIN label line, the key's binary encoding rendered as base64 text, and a matching END line. The label names the container, such as PUBLIC KEY or RSA PRIVATE KEY. Save the block verbatim, envelope lines included, to a file ending in .pem. The private-key block is the sensitive half - treat it like a password, not a config value.

Good uses

  • Exercising sign, verify, encrypt, and decrypt code paths in tests with a throwaway pair - TLS test certificates, JWT signing, or JWKS fixtures - then discarding the pair when the test ends.
  • Provisioning a lab or staging server that expects a PEM key: install the private key on the server and give the public key to the clients or verifiers that must trust it.
  • Learning how the halves relate: generate pairs at different sizes, derive the public key from the private one, and confirm they match before wiring either into anything.

Limits and checks

  • The pair is generated locally in your browser and nothing is uploaded, but nothing is stored either: reloading the page or clicking Generate again yields a different, unrelated pair. If the private key is lost before you save it, generate a fresh pair and replace the public half on every system that trusts it.
  • Key size is not proportional to security. Per NIST SP 800-57, 2048-bit RSA is rated at roughly 112 bits of security strength and 3072-bit at 128 bits; 4096 adds only a small margin at several times the generation and per-operation cost. For new systems, 3072-bit - or an elliptic-curve key - usually makes more sense.
  • The PEM label identifies the container. A block starting with RSA PRIVATE KEY (PKCS#1) and one starting with PRIVATE KEY (PKCS#8) are parsed differently; openssl pkey reads both, while some tools accept only one label. Check the label against what the consuming software documents before wiring the key in.

Common questions

Can I regenerate the same pair if I lose the private key?

No. Each run generates from fresh randomness, so the exact same pair cannot be reproduced; the private key exists only where you saved it. If it is lost, generate a new pair and redeploy the public key to every system that trusts the old one - that is the only recovery path.

Is a 4096-bit key more secure than a 2048-bit one?

Modestly. NIST's key-management guidance rates 2048-bit RSA at about 112 bits of security strength and 3072-bit at 128 bits, so 4096 buys a small margin at several times the cost of generation, signing, and encryption. For most deployments 3072-bit is a reasonable ceiling; elliptic-curve keys such as secp256r1 or Ed25519 reach comparable strength with far smaller keys.

References and verification

The behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools