Skip to content

RSA Key Generator

Make RSA, ECDSA and Ed25519 key pairs as PEM, JWK or SSH. Runs in your browser.

Loading tool…

About this rsa key generator

This RSA key generator creates a public and private key pair in your browser and gives it to you in every format you are likely to need: PEM (SPKI and PKCS#8), the older PKCS#1 layout, JWK with a key ID, and OpenSSH. It's for developers setting up JWT signing, testing encryption code, or making a quick SSH key.

Pick RSA-OAEP for encryption, RSA-PSS or RSASSA-PKCS1-v1_5 for signatures, at 2048, 3072 or 4096 bits. ECDSA on P-256, P-384 or P-521 and Ed25519 are there too, for when a smaller, faster key fits better. The page makes a 2048-bit pair as soon as it opens, so you can see the output before you choose.

Keys are created by the Web Crypto API built into your browser. Nothing is uploaded, and each new pair is checked with a real sign-and-verify or encrypt-and-decrypt round trip before you copy it.

Features

  • RSA, ECDSA and Ed25519

    RSA-OAEP, RSA-PSS and RSASSA-PKCS1-v1_5 with SHA-256, 384 or 512. ECDSA on the three NIST curves. Ed25519 where the browser supports it; the option is greyed out if yours doesn't.

  • PEM in both layouts

    BEGIN PUBLIC KEY and BEGIN PRIVATE KEY (SPKI and PKCS#8) for modern libraries, plus BEGIN RSA PUBLIC KEY and BEGIN RSA PRIVATE KEY (PKCS#1) for older tools that insist on them.

  • JWK with kid and alg

    Public and private JWKs and a ready JWKS file. The kid is the RFC 7638 thumbprint, and alg is set to the matching JOSE name such as RS256, PS256, RSA-OAEP-256 or ES256. Each member can be switched off.

  • Real OpenSSH files

    An authorized_keys line and an openssh-key-v1 private key file, the same format ssh-keygen writes. We checked them with ssh-keygen -y, which reads the private key back and prints the matching public key.

  • Fingerprints

    The SSH SHA256 fingerprint, the JWK thumbprint and the Base64 SHA-256 of the SPKI, which is the value used for public key pinning.

  • One ZIP with everything

    Download all formats at once: PEM, PKCS#1, JWK, JWKS and the two SSH files, named the way tools expect them.

How to use the rsa key generator

  1. 1Choose the algorithm, then the key size, hash or curve.
  2. 2Press Generate key pair. The pair is tested with a sign or encrypt round trip.
  3. 3Copy or download the PEM, PKCS#1, JWK or OpenSSH files, or get them all as a ZIP.

When to use it

  • Signing JWTs

    Choose RSASSA-PKCS1-v1_5 with SHA-256 for RS256, or ECDSA P-256 for ES256. Put the JWKS on your auth server and the private PEM in your signing service. You can then paste a token into the JWT decoder to check its header.

  • Testing encryption code

    Generate an RSA-OAEP pair, encrypt with the public key in your app and decrypt with the private one. For bulk data, encrypt a random key with RSA and the data itself with AES, since RSA can only encrypt a few hundred bytes.

  • A throwaway SSH key

    Pick Ed25519, set the comment, and download id_ed25519 and id_ed25519.pub for a test VM or a CI job. Add a passphrase afterwards with ssh-keygen -p.

Which RSA key size should I use?

NIST SP 800-57 Part 1 rates a 2048-bit RSA key at 112 bits of security and a 3072-bit key at 128 bits. 2048 is the usual minimum today, and the CA/Browser Forum rules for public TLS certificates require at least 2048 bits. NIST plans for 112-bit security to be phased out after 2030, so pick 3072 for keys that must stay in service longer.

4096-bit keys are slower. Generating one takes anywhere from under a second to several seconds, depending on your device, and every signature costs more CPU. If you want stronger and faster at the same time, ECDSA P-256 gives 128-bit security with a 256-bit key, and Ed25519 is similar.

PEM, PKCS#1, PKCS#8 or JWK: what's the difference?

They're the same key in different wrappers. PEM is just Base64 text between BEGIN and END lines. What changes is the structure inside.

  • SPKI (BEGIN PUBLIC KEY): the standard public key format from RFC 5280. It names the algorithm, so it works for RSA, EC and Ed25519 alike.
  • PKCS#8 (BEGIN PRIVATE KEY): the standard private key container from RFC 5208. Node.js, Java, Go and OpenSSL 3 all read it.
  • PKCS#1 (BEGIN RSA PRIVATE KEY): the older RSA-only layout from RFC 8017. Some PHP, Ruby and legacy libraries still expect it.
  • JWK: the key as JSON, defined in RFC 7517. Used by JOSE libraries and published in a JWKS file at a URL like /.well-known/jwks.json.

Is it safe to generate an RSA key online?

It's safe when the key is made on your own device and nothing leaves it, which is how this page works. Web Crypto generates the key inside the browser's own crypto code, using the operating system's secure random source. There is no server call to watch for in your network tab.

Even so, a key is only as safe as the places it has been. A browser tab can have extensions running in it. For a production TLS or SSH host key, the cleanest habit is to create the key on the machine that will use it and never move it. Use this page for development, testing, CI and one-off keys.

Why use Mavros

 MavrosTypical upload sites
Where keys are madeYour browser, Web Crypto APIOften on the site's server
FormatsPEM, PKCS#1, JWK, JWKS, OpenSSHPEM only
AlgorithmsRSA-OAEP, RSA-PSS, RS256, ECDSA, Ed25519RSA only
Pair checkSign or encrypt round trip on every pairNone
Key IDRFC 7638 thumbprint as kidNot provided

Tips

  • The private key output is unencrypted. Store it in a secrets manager or add a passphrase before it goes anywhere near a shared drive.
  • If a library rejects BEGIN PRIVATE KEY with an RSA error, switch to the PKCS#1 tab. That's the most common format mix-up.
  • To check that a certificate matches your key, compare the SPKI SHA-256 pin here with the one the certificate decoder shows.
  • For symmetric secrets such as HMAC keys, you don't need a key pair. A 64-character hex string from the random string generator is enough.

Questions

How do I generate an RSA key pair online?

Choose the RSA algorithm and size, then press Generate key pair. The public and private keys appear in PEM, and the tabs switch to PKCS#1, JWK or OpenSSH. Copy each one or download them all as a ZIP.

Is 2048-bit RSA still secure?

Yes, for now. NIST rates it at 112 bits of security and plans to retire that level after 2030. Use 3072-bit for keys that must last longer, or switch to ECDSA P-256 or Ed25519.

What is the difference between RSA-OAEP and RSA-PSS?

RSA-OAEP is the padding for encryption, and RSA-PSS is the padding for signatures. Web Crypto ties each key to one job, so pick OAEP to encrypt and PSS or PKCS1-v1_5 to sign.

Which option do I need for RS256 JWTs?

Pick RSASSA-PKCS1-v1_5 with SHA-256. The JWK will carry alg RS256. For PS256 choose RSA-PSS with SHA-256, and for ES256 choose ECDSA on P-256.

Can I use these keys for SSH?

Yes. The OpenSSH tab gives an authorized_keys line and a private key file in the openssh-key-v1 format that ssh-keygen writes. Save the private key with chmod 600 and add a passphrase with ssh-keygen -p.

What is a JWK thumbprint?

It is a SHA-256 hash of the key's required JWK members in a fixed order, defined in RFC 7638. Because anyone can compute it from the public key, it makes a stable key ID, and that's what we put in kid.

Why is Ed25519 greyed out?

Your browser's Web Crypto API doesn't support Ed25519 yet. Update the browser, or use ECDSA P-256, which every current browser supports.