Free RSA Key Pair Generator (PEM)

Free RSA key pair generator. Create 2048, 3072 or 4096-bit keys and copy them as PEM PKCS#8 and SPKI, PKCS#1 or JWK. Generated with Web Crypto in your browser.

  • No upload, 100% private
  • Instant, in your browser
  • 100% free, no signup
Loading tool…
Read the complete guideRSA Key Formats Explained: PKCS#1 vs PKCS#8 vs JWK and Conversion →

About the RSA Key Pair Generator tool

RSA key pairs are still everywhere: signing JWTs with RS256, encrypting small secrets, configuring SAML or OAuth clients, testing TLS code and exchanging data with partners. The problem is usually not creating the key but getting it in the format a particular library expects. One wants BEGIN PRIVATE KEY, another insists on BEGIN RSA PRIVATE KEY, a third wants a JSON Web Key.

This generator creates an RSA key pair of 2048, 3072 or 4096 bits with public exponent 65537 using the browser's Web Crypto API, then gives you the same key in three encodings. The PKCS#8 / SPKI tab has the modern PEM files read by OpenSSL 3, Node.js, Java and Go. The PKCS#1 tab unwraps them into the traditional RSA-only PEM that older PHP, Ruby and OpenSSL 1.x code expects. The JWK tab has the public and private key as JSON for JOSE libraries and JWKS endpoints.

The SHA-256 fingerprint of the public key is shown so you can identify it later. Nothing is uploaded: keys are produced and encoded on your device, and the output has been verified with OpenSSL.

How to use RSA Key Pair Generator

  1. Pick a “Key size”: 2048, 3072 or 4096-bit.
  2. Click “Generate RSA key pair” and wait a moment (4096-bit keys can take a few seconds).
  3. Open the PKCS#8 / SPKI, PKCS#1 or JWK tab depending on the format your software needs.
  4. Copy or download the public key and the private key files.

Features

2048, 3072 and 4096-bit keys

Generated with Web Crypto using exponent 65537 and the browser's secure random generator.

PKCS#8 and SPKI PEM

BEGIN PRIVATE KEY and BEGIN PUBLIC KEY files that modern libraries read directly.

PKCS#1 conversion

The same key as BEGIN RSA PRIVATE KEY and BEGIN RSA PUBLIC KEY for legacy code.

JWK export

Public and private JSON Web Keys without browser-specific fields, ready for a JWKS file.

Public key fingerprint

SHA-256 of the DER public key, useful for key IDs and comparisons.

When to use it

  • Create an RS256 key pair to sign and verify JWTs in a Node.js or Python API.
  • Generate a test key for SAML single sign-on or an OAuth private key JWT client.
  • Produce a PKCS#1 key for an older PHP library that rejects PKCS#8.
  • Build a JWKS document for a development identity server.

Frequently asked questions

Which key size should I use?

2048-bit is the common minimum and fine for most uses. 3072-bit gives roughly 128-bit security and is recommended for keys meant to last beyond 2030. 4096-bit is slower to generate and use, with limited practical gain.

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

PKCS#1 stores only an RSA key. PKCS#8 wraps any private key type with an algorithm identifier. The key material is identical; only the wrapper changes.

Is the private key encrypted?

No, the PEM files are unencrypted. To add a password run openssl pkcs8 -topk8 -v2 aes-256-cbc -in private.pem -out private-enc.pem, or keep the key in a secrets manager.

Can I use these keys for SSH?

SSH needs a different public key format. Use the SSH Key Generator for an ssh-rsa or ssh-ed25519 key pair.

Is the key sent to a server?

No. Generation and encoding happen in your browser and nothing is uploaded or saved.

Related tools