JWT Key Pair Generator
Generate RSA or EC key pairs for signing JWTs with RS256, PS256, or ES256
About this tool
The JWT Key Pair Generator creates asymmetric key pairs for signing JSON Web Tokens with RSA (RS256/384/512, PS256/384/512) or ECDSA (ES256/384/512) algorithms, using the browser's native WebCrypto API. Unlike HMAC-based JWTs which share a single secret between signer and verifier, these algorithms let you keep a private key for signing and distribute a public key for verification — the setup required by OAuth providers, OpenID Connect, and most production JWT-based auth systems. Both keys are exported in two formats: PEM (the classic `-----BEGIN...-----` text format used by most server libraries and CLI tools) and JWK (JSON Web Key, used by JWKS endpoints and browser-native crypto APIs). Pick your algorithm and, for RSA, a key size (2048 or 4096-bit), and get all four key representations at once. Key generation happens entirely in your browser via WebCrypto — private keys are never transmitted anywhere, but treat any private key generated on a shared or untrusted machine with the same caution you'd apply to a production secret.
When to use it
- →Generating an RS256 key pair for signing JWTs in a Node.js or Python auth service
- →Creating an ES256 key pair for a JWKS endpoint used by OpenID Connect clients
- →Producing test key pairs for local development without touching production key material
- →Getting both PEM and JWK formats of the same key without running separate conversion tools
Tips
- ◆ES256 (ECDSA) produces much shorter keys and signatures than RS256 for equivalent security — prefer it for new systems if your libraries support it.
- ◆2048-bit RSA is the current minimum recommended size; use 4096-bit only if a specific compliance requirement calls for it, since it's slower and produces larger tokens.
- ◆Never paste a generated private key into a public repository, client-side code, or a chat tool — treat it exactly like a database password.
Frequently asked questions
What's the difference between RS256, PS256, and ES256?
RS256 and PS256 are both RSA-based (PS256 uses the more modern RSA-PSS padding scheme instead of PKCS#1 v1.5). ES256 uses ECDSA on elliptic curves, producing much smaller keys and signatures for equivalent security. Most modern systems prefer ES256 for its size, but RS256 remains the most widely supported across older libraries.
Which key do I use for signing vs. verifying?
The private key signs tokens and must be kept secret on your auth server. The public key verifies tokens and can be shared freely — it's typically published at a JWKS endpoint so any service can verify tokens without holding the private key.
Should I use this to generate production keys?
The cryptography (WebCrypto's RSA and ECDSA implementations) is sound and suitable for real use, but for production systems, prefer generating keys on the server or infrastructure that will actually hold the private key, using your standard key-management process — minimizing how many places a private key is ever displayed or copied.