RSA Key Generator

Pick a key size and get a public and a private key in PEM, ready for OpenSSL, Node, Java, Go and JWT libraries. The keys are made on this device by your browser’s own WebCrypto and never leave it.

How it works

Your browser has a built-in crypto engine called WebCrypto. This page asks it to make a fresh RSA key pair of the size you pick, with the standard public exponent 65537. The randomness comes from the operating system, the same source a native tool such as OpenSSL uses.

The public key is written as SPKI ("BEGIN PUBLIC KEY") and the private key as PKCS#8 ("BEGIN PRIVATE KEY"). These are the two containers almost every library reads without conversion. The fingerprint is the SHA-256 of the public key’s bytes, so you can check later that two copies are the same key.

Nothing is sent to a server and nothing is stored. The keys exist only in this page’s memory until you copy or download them, and they are gone when you close the tab.

How to use it

  1. 1 Choose a Key size: 2048, 3072 or 4096 bits. A 4096-bit key can take a few seconds.
  2. 2 Wait for the Public key (SPKI PEM) and Private key (PKCS#8 PEM) boxes to fill.
  3. 3 Copy each key, or download them as public.pem and private.pem.
  4. 4 Note the SHA-256 fingerprint if you need to check the key later.
  5. 5 Press Regenerate for a new pair. The old one is not kept anywhere.

Good to know

  • The private key is not encrypted. Store it like a password. To add a passphrase, run: openssl pkcs8 -topk8 -v2 aes-256-cbc -in private.pem -out private-enc.pem
  • Some older software wants the PKCS#1 form, "BEGIN RSA PRIVATE KEY". Convert with: openssl pkey -in private.pem -traditional
  • 2048 bits is still the common minimum. 3072 bits matches the strength most guidance asks for after 2030. 4096 is slower to use and rarely needed.
  • The same key works for RS256 and PS256 signatures and for RSA-OAEP encryption. The file does not record which one you meant.
  • If you only need a signing key, an elliptic-curve key is far smaller and faster. See the Key Pair Generator.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Why every 2048-bit public key starts with MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA

Make a few 2048-bit keys on this page and look at the public keys. The first 44 characters after the BEGIN line are always the same: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA. Only after that does each key differ. That is not a coincidence or a weakness. It is the label and the packaging, and taking it apart shows exactly what a public key file holds.

Base64 is just a spelling of bytes, 3 bytes for every 4 characters, so those 44 characters are the first 33 bytes of the key. In hex they are 30 82 01 22, 30 0d, 06 09 2a 86 48 86 f7 0d 01 01 01, 05 00, 03 82 01 0f 00, 30 82 01 0a, 02 82 01 01 00. This is DER, a strict binary form of ASN.1, where every item is a type byte, a length and then the contents. The first item, 30 82 01 22, opens a SEQUENCE that is 0x0122, or 290, bytes long. Add the 4 header bytes and the whole key is 294 bytes. Every 2048-bit public key with exponent 65537 is exactly 294 bytes.

Inside, 30 0d opens the algorithm identifier. Its 06 09 is an object identifier nine bytes long, and those nine bytes spell 1.2.840.113549.1.1.1, the name the RSA standard gave "rsaEncryption" in the 1990s. The 05 00 after it is an empty NULL parameter, a quirk the format still requires. Then 03 82 01 0f 00 starts a BIT STRING of 271 bytes, whose first byte says no bits are unused. Inside that sits a second SEQUENCE, 30 82 01 0a, holding the actual RSA numbers.

The first number is the modulus, introduced by 02 82 01 01: an INTEGER 257 bytes long. A 2048-bit modulus is 256 bytes, and its top bit is always set, so DER adds a 00 in front to keep the number positive. That 00 is the last byte of the common prefix. From there on come the 256 bytes that make your key yours. The key then ends with 02 03 01 00 01, a 3-byte INTEGER holding 65537, the public exponent nearly every RSA key uses because it is fast and safe. You can check all of this yourself with openssl asn1parse -in public.pem.

The same reading explains a few things people trip over. A 4096-bit key has a different prefix, because the lengths in the headers change. The private key file in PKCS#8 has its own repeated start, MIIE for a 2048-bit key, for the same reason. And the fingerprint shown on this page is the SHA-256 of all 294 bytes, so two files with different line breaks or a trailing newline still give the same fingerprint, while a key that differs in a single bit does not.

There are limits worth stating. This page makes the key and writes it out. It does not encrypt the private key, sign certificates or make a certificate signing request; OpenSSL does those once you have the files. And because the private key is printed in plain text, the safest habit is to download it straight to where it will live, rather than leaving it on the clipboard.

Frequently asked questions

Is it safe to make a private key in a web page?

Here the key is made by the browser’s WebCrypto, which uses the operating system’s random number generator, and the page never sends it anywhere. You can load the page, go offline, and it still works. The real risk is the same as with any tool: where you save the private key afterwards.

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

They are containers. SPKI holds a public key and says which algorithm it is for. PKCS#8 does the same for a private key. PKCS#1 is an older, RSA-only form ("BEGIN RSA PRIVATE KEY") that omits the algorithm label. The key inside is identical; OpenSSL converts between them in one command.

Which key size should I pick?

Use 2048 if a system requires compatibility, 3072 for new keys you will keep for years, and 4096 only if a policy asks for it. Each step up makes signing noticeably slower for a modest gain in strength.

Can I protect the private key with a password here?

Not on this page. The key is written unencrypted so you can choose how to protect it. The openssl pkcs8 command in the tips adds an AES-256 passphrase and produces "BEGIN ENCRYPTED PRIVATE KEY".

Can I use this for SSH?

Not directly. SSH uses its own file formats. Use the SSH Key Generator, which writes id_rsa or id_ed25519 files that ssh and GitHub accept.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.