RSA Key Generator

Key Exchange

Processed locally in your browser using the Web Crypto API. Nothing is sent to any server.

How It Works

This tool generates RSA key pairs using the browser's native crypto.subtle.generateKey() API. Keys can be exported in PEM, DER, or JWK format — covering every major cryptographic ecosystem from OpenSSL and SSH to Java, Windows, and web APIs. All processing happens locally in your browser; no key material is ever sent to a server.

Key Generation Details

  • Algorithm: RSA-OAEP (Optimal Asymmetric Encryption Padding)
  • Key sizes: 2048-bit or 4096-bit
  • Public exponent: 65537 (standard choice, balances security and performance)
  • Hash algorithms: SHA-256 (default), SHA-384, or SHA-512 for OAEP padding
  • Implementation: Native Web Crypto API — no JavaScript libraries

Export Formats

  • PEM — Base64-encoded with header/footer lines. Public key uses SPKI (SubjectPublicKeyInfo), private key uses PKCS#8. The universal standard for OpenSSL, SSH, and most libraries.
  • DER — Raw binary encoded as Base64. Common in Java keystores, Windows CryptoAPI, and X.509 certificates.
  • JWK — JSON Web Key (RFC 7517). Used in JWT, JWS, and web authentication APIs.
  • SSH — OpenSSH public key format (ssh-rsa ...). Used for GitHub, GitLab, and SSH server authentication.
  • PKCS#1 — Traditional RSA private key format (BEGIN RSA PRIVATE KEY). Legacy compatibility.
  • Encrypted PEM — Private key encrypted with passphrase using PBKDF2-SHA256 + AES-CBC (OpenSSL traditional format).

How RSA Works

  1. Two large prime numbers are generated randomly
  2. Mathematical operations create a public/private key pair from these primes
  3. The public key can encrypt data that only the private key can decrypt
  4. The private key can also sign data that only the public key can verify

Common Use Cases

  • Secure key exchange (encrypting symmetric keys for transmission)
  • Digital signatures (proving data authenticity)
  • TLS/SSL certificates for HTTPS
  • Secure email (PGP/GPG)
  • Code signing and software distribution

Frequently Asked Questions

What is RSA?

RSA (Rivest–Shamir–Adleman) is a public-key cryptosystem used for secure data transmission. It uses a pair of mathematically related keys — a public key for encryption and a private key for decryption — making it possible to securely communicate without sharing a secret key beforehand.

What key size should I use?

2048-bit RSA provides security equivalent to 112-bit symmetric encryption and is sufficient for most applications through 2030. 4096-bit provides 128-bit equivalent security and is recommended for long-term protection. Larger keys are more secure but slower to generate and use.

What export formats are supported?

Multiple formats are supported: PEM (SPKI/PKCS#8, standard for OpenSSL/SSH), DER (raw binary as Base64, used in Java/Windows/X.509), JWK (JSON Web Key, RFC 7517), SSH public key format (ssh-rsa ...), and PKCS#1 private key format (BEGIN RSA PRIVATE KEY). You can also export an encrypted private key with passphrase protection.

What is the SSH public key format?

SSH format starts with "ssh-rsa" followed by a Base64-encoded binary structure containing the key type, public exponent, and modulus. This is the format used by OpenSSH, GitHub, GitLab, and most SSH servers for public key authentication. You can download or copy the SSH format directly from the results.

What is PKCS#1 vs PKCS#8?

PKCS#1 (BEGIN RSA PRIVATE KEY) is the traditional RSA-specific private key format. PKCS#8 (BEGIN PRIVATE KEY) is a newer algorithm-independent format that wraps PKCS#1 with additional metadata. Most modern tools accept both, but PKCS#8 is preferred for new deployments. This tool generates both formats for maximum compatibility.

How do I encrypt the private key with a passphrase?

Expand the "Encrypt Private Key with Passphrase" panel, enter your passphrase, choose a cipher (AES-256-CBC recommended), and generate the key pair. An additional encrypted PEM copy will be included in the results. The encryption uses PBKDF2-SHA256 with 100,000 iterations for key derivation, compatible with OpenSSL.

Which hash algorithm should I choose?

SHA-256 is the standard choice and provides a good balance of security and performance. SHA-384 and SHA-512 offer higher security margins but are slightly slower. All three are used in the RSA-OAEP padding scheme. For most applications, SHA-256 is recommended.

Can I generate multiple key pairs at once?

Yes. Use the Batch Quantity selector to generate 1, 2, 5, or 10 key pairs in a single operation. All pairs are generated independently with fresh random primes. The result view shows the last generated pair; you can copy or download each individually.

How do I import and analyze a public key?

Expand the "Import & Analyze Public Key" panel and paste your public key in PEM, JWK, SSH, or Base64 DER format. Click "Parse Key" to view its metadata including key size, algorithm, public exponent, modulus, and SHA-256 fingerprint. This is useful for verifying a received key matches expectations.

Privacy Note

This tool runs entirely in your browser. Your input is never uploaded, stored, or sent to any server.

Disclaimer: This tool is provided for educational and informational purposes only. The results do not constitute professional security advice. Use at your own discretion.

More in Key Exchange