RSA and EC Key Pair Generator

Generate RSA 2048 to 4096, ECDSA P-256 to P-521 or Ed25519 key pairs in your browser and export PEM, JWK and OpenSSH files with SHA256 fingerprints.

The interactive tool loads here when JavaScript runs.

About this tool

What is the RSA and EC Key Pair Generator?

Choose RSA, ECDSA or Ed25519, press Generate, and this tool creates a key pair in your browser and shows it in every format you are likely to need: PEM (PKCS#8 private key and SPKI public key), JSON Web Keys, an OpenSSH public key line for authorized_keys and an OpenSSH private key file you can save as ~/.ssh/id_ed25519. Each output has copy and download buttons, and the SHA256 fingerprint is printed exactly as ssh-keygen -l would show it.

RSA keys come in 2048, 3072 or 4096 bits for PKCS#1 v1.5 or PSS signatures or OAEP encryption; ECDSA keys use the NIST curves P-256, P-384 or P-521; Ed25519 appears when the browser supports it. The public JWK also gets an RFC 7638 thumbprint, the value many JWKS endpoints use as the key ID.

Keys are created with crypto.subtle.generateKey, which draws on the operating system's secure random number generator. Nothing is uploaded, and the private key leaves the page only when you copy or download it.

  • RSA 2048, 3072 and 4096 for PKCS#1 v1.5, PSS and OAEP
  • ECDSA P-256, P-384 and P-521, and Ed25519 where supported
  • PKCS#8 and SPKI PEM, JWK, OpenSSH public line and openssh-key-v1 private file
  • SHA256 fingerprint identical to ssh-keygen -l
  • RFC 7638 JWK thumbprint for key IDs
  • Security strength per NIST SP 800-57
  • Generated locally with Web Crypto; OpenSSH output verified with ssh-keygen
Read the guide: RSA vs ECDSA vs Ed25519: Choosing and Formatting Key Pairs

How to use the RSA and EC Key Pair Generator

  1. Choose RSA, ECDSA or Ed25519.
  2. For RSA, pick the size (2048 or 3072 for most uses) and the intended use: PKCS#1 v1.5 signing for SSH and RS256, PSS for PS256, or OAEP for encryption. For ECDSA, pick the curve.
  3. Enter a comment for the OpenSSH line, usually user@host, and press Generate key pair.
  4. Open the PEM, OpenSSH or JWK tab and copy or download what you need.
  5. Protect the private key: add a passphrase with ssh-keygen -p or openssl pkcs8 -topk8 -v2 aes-256-cbc before storing it.

Worked examples

SSH key for a new laptop

Input

Ed25519, comment me@laptop

Output

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... me@laptop, plus an OpenSSH private key file

Save the private file as ~/.ssh/id_ed25519 with mode 600 and paste the public line into GitHub or a server's authorized_keys.

JWT signing key

Input

RSA 2048, PKCS#1 v1.5, SHA-256

Output

Private JWK with alg RS256, public JWK and thumbprint for the kid

Publish the public JWK at your JWKS endpoint and keep the private JWK or PKCS#8 PEM in your secret store.

ECDSA for a certificate signing request

Input

ECDSA P-256

Output

PKCS#8 private key (138 bytes of DER) and a 91-byte SPKI public key

openssl req -new -key private.pem builds a CSR from the PEM. P-256 certificates are accepted by every current browser.

Background and insight

RSA, published in 1977, bases its security on the difficulty of factoring a modulus n that is the product of two large primes. NIST SP 800-57 Part 1 rates a 2048-bit modulus at 112 bits of security and 3072 bits at 128, and NIST's transition guidance (SP 800-131A, and the draft IR 8547) treats 112-bit strength as acceptable only through 2030. The public exponent is the standard 65537. A 4096-bit key is slower to generate and use and still rated at 128 bits, so 3072 is the efficient step up from 2048.

Elliptic-curve keys reach the same strength with far smaller numbers. P-256 gives about 128 bits of security with a 32-byte private key and 64-byte signatures, P-384 gives 192 and P-521 gives 256 (FIPS 186-5). Ed25519 (RFC 8032) is an Edwards-curve signature scheme at about 128 bits, with deterministic signatures that do not depend on a random nonce at signing time, and is the key type OpenSSH's ssh-keygen creates by default since version 9.5.

The formats say the same thing in different wrappers. PKCS#8 (RFC 5208) and SubjectPublicKeyInfo (RFC 5280) are DER structures, Base64-wrapped as PEM with BEGIN PRIVATE KEY and BEGIN PUBLIC KEY lines. JWK (RFC 7517 and 7518) lists the key's numbers as Base64url JSON fields. OpenSSH writes public keys in the RFC 4253 wire format and private keys in its own openssh-key-v1 container. The OpenSSH files from this tool are checked in the test suite by loading them with ssh-keygen itself.

Common use cases

  • SSH access

    Create an Ed25519 or RSA key pair and an authorized_keys line on a machine where ssh-keygen is not available.

  • JWT and OAuth development

    Make RS256, PS256 or ES256 signing keys and the public JWK for a local identity provider or test fixtures.

  • Learning key formats

    Compare the same key as PEM, JWK and OpenSSH and see what each format contains.

  • Test certificates

    Produce a PKCS#8 key to feed into openssl req for a development certificate.

Tips and limitations

  • For production servers, certificate authorities and HSM-backed signing, generate keys on the machine that uses them. A browser tab is convenient but is one more place a key has existed.
  • Downloaded private keys are unencrypted. Add a passphrase immediately and set file permissions to 600.
  • RSA-OAEP keys are for encryption and have no SSH form, so the OpenSSH tab is disabled for them.
  • Safari and older browsers may lack Ed25519 in Web Crypto. The option is disabled when the browser cannot generate it.
  • The key use you pick is recorded in the JWK alg field. Reusing one RSA key for both signing and encryption is discouraged.

Frequently asked questions

Should I use RSA 2048 or 4096?

RSA 2048 is acceptable today at 112-bit strength, but NIST guidance only allows that level through 2030. If you need RSA, 3072 bits gives 128-bit strength; 4096 adds generation and signing time without a higher NIST rating. For new SSH keys, Ed25519 is smaller and faster.

Is Ed25519 better than RSA for SSH?

For most people, yes. Ed25519 keys are 68 characters of Base64, sign quickly, and avoid RSA's padding and key-size choices. RSA is still needed for a few old servers and devices that do not support Ed25519.

What is the difference between PKCS#1 and PKCS#8 private keys?

PKCS#1 (BEGIN RSA PRIVATE KEY) holds only RSA keys. PKCS#8 (BEGIN PRIVATE KEY) is a generic wrapper with an algorithm identifier, so it can hold RSA, EC or Ed25519 keys and is what most modern libraries expect. This tool exports PKCS#8.

Can I use these keys with OpenSSH?

Yes. Save the OpenSSH private key as id_ed25519, id_ecdsa or id_rsa in ~/.ssh with permissions 600, and add the public line to the server's authorized_keys. The files are in the format ssh-keygen writes and are tested by loading them back with ssh-keygen.

How do I convert the JWK to PEM or back?

Both are shown here for the same key, so no conversion is needed. For an existing key, Web Crypto can import a JWK and export SPKI or PKCS#8, which is what our JWK tool does, and openssl pkey can read the PEM.

Is it safe to generate a private key in a browser?

The randomness comes from the same operating-system source that ssh-keygen and OpenSSL use, and the key never leaves the page unless you copy it. The residual risk is the device and browser themselves, such as malicious extensions, so use a trusted machine for keys that matter.

What does the SHA256 fingerprint show?

It is the SHA-256 hash of the OpenSSH public key blob in Base64 without padding, the value ssh-keygen -l and GitHub display. Compare it when a server or service asks you to confirm which key you added.

Is there an in-depth guide to the RSA and EC Key Pair Generator?

Yes. “RSA vs ECDSA vs Ed25519: Choosing and Formatting Key Pairs” covers the background, how it works, common pitfalls and worked examples. Read the full guide.

People also search for

  • generate rsa key pair online pem
  • rsa 2048 vs 4096 which is better
  • ed25519 vs rsa for ssh keys
  • export rsa key pair as jwk and pem
  • generate ssh key without ssh-keygen
  • pkcs8 vs pkcs1 private key format
  • ecdsa p-256 key pair generator
  • what is a jwk thumbprint