Skip to content

RSA Key Generator

Generate a 2048- or 3072-bit RSA-OAEP key pair with SHA-256 and export standard public and private PEM locally.

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Confirm the application requires RSA-OAEP with SHA-256, exponent 65537 and SPKI/PKCS#8 PEM.
  2. 2.Choose 2048 or 3072 bits and generate; allow extra time for the larger modulus.
  3. 3.Distribute only the public key, import the private key directly into protected storage, and perform an end-to-end encryption test.

About RSA Key Generator

RSA Key Generator creates a fresh asymmetric key pair in the browser with RSA-OAEP and SHA-256. Choose a 2048- or 3072-bit modulus, generate, then copy the public key as SubjectPublicKeyInfo PEM and the private key as unencrypted PKCS#8 PEM. No key bytes are sent to the application server.

RSA uses a public key for encryption and a mathematically related private key for decryption. This page asks the platform Web Cryptography implementation to generate two large primes and exponent 65537. Random output is expected: generating twice must produce different keys even with identical settings.

The public PEM begins with BEGIN PUBLIC KEY and contains an ASN.1 SPKI structure. It can be distributed to systems that need to encrypt for the holder. The private PEM begins with BEGIN PRIVATE KEY and contains PKCS#8 key material. Anyone who obtains it can decrypt compatible ciphertext, so copying it transfers full responsibility for protection.

Private output is not password-encrypted. Store it only in an appropriate secret manager or encrypted keystore with strict access control and backups. Do not place it in source control, tickets, chat, analytics, browser sync or ordinary notes. Close the tab and clear clipboard history after securely importing it.

RSA-OAEP parameters must match on both sides. These keys declare SHA-256, but another system may default to SHA-1 or use different label and mask-generation settings. A PEM that imports successfully is not enough; perform an end-to-end test with the exact application protocol before relying on it.

RSA encrypts only limited-size messages. Applications normally encrypt a random symmetric key with RSA-OAEP and protect the actual data with authenticated symmetric encryption. Do not split a large file into raw RSA blocks. This page generates keys and intentionally does not invent a hybrid file format.

The offered sizes balance compatibility and browser cost. 2048 bits is broadly interoperable; 3072 bits provides a larger security margin with slower generation and operations. The tool does not offer 1024-bit keys, custom public exponents, raw RSA, PKCS#1 v1.5 encryption or SHA-1 because safer fixed choices reduce misuse.

Correctness cannot use a fixed private-key golden value because secure generation must be random. Instead, tests lock eight external parameter invariants, export both envelopes, import the generated SPKI and PKCS#8 back into Web Crypto, encrypt a known UTF-8 message with the public key and assert exact recovery with the private key. The imported algorithm must report the selected modulus length.

Generation is asynchronous and a job identity prevents an older request from overwriting newer settings. The private and public outputs are kept only in component memory until navigation or replacement, although browser extensions, malware, clipboard managers and screenshots remain outside that boundary. Use a trusted patched device.

Use the generator after confirming the recipient expects RSA-OAEP with SHA-256 and one of these PEM envelopes. Generate once, copy the public key to the consumer, transfer the private key directly into protected storage, and run a protocol-level round trip. Rotate immediately if the private key is exposed.

This utility is not a certificate authority and does not create X.509 certificates, CSRs, signatures, SSH keys or JSON Web Keys. Converting formats later must preserve algorithm parameters and private-key secrecy. For production identity or TLS, prefer the key-generation workflow provided by the owning platform or hardware security module.

Methodology & sources

WebCrypto generateKey creates extractable RSA-OAEP keys with SHA-256, modulus 2048 or 3072 and exponent 65537. The public key exports as SPKI DER and private key as PKCS#8 DER, then each is Base64-wrapped at 64 columns.

Frequently asked questions

Encoding & Crypto guides

View all