JWK Converter and Generator

Convert JWK to PEM and PEM to JWK, generate RSA, EC P-256 and Ed25519 key pairs, and get the RFC 7638 thumbprint. Uses Web Crypto; keys stay local.

The interactive tool loads here when JavaScript runs.

About this tool

What is JWK Converter?

The JWK Converter turns JSON Web Keys into PEM and PEM keys back into JWK, and generates new signing key pairs. Convert to PEM accepts a single JWK or a JWK Set (the {"keys": [...]} document served at a JWKS endpoint) and outputs an SPKI public key, plus a PKCS#8 private key when the JWK contains private members. Convert to JWK accepts PUBLIC KEY, RSA PUBLIC KEY, PRIVATE KEY, RSA PRIVATE KEY, EC PRIVATE KEY or a CERTIFICATE.

Every conversion also shows the key's RFC 7638 thumbprint, the SHA-256 value many systems use as a stable kid. Generate JWK creates RS256, PS256, ES256, ES384 or EdDSA (Ed25519) key pairs with the kid set to that thumbprint.

All of this uses the browser's Web Crypto API, so keys are created and converted in your tab and never sent anywhere. Web Crypto supports the NIST curves P-256, P-384 and P-521 plus Ed25519 and X25519; secp256k1 keys (used by some blockchain JWTs) are rejected with a clear message.

  • JWK and JWKS to SPKI and PKCS#8 PEM
  • PEM, PKCS#1, SEC1 and certificate input to JWK
  • RS256, PS256, ES256, ES384 and Ed25519 key generation
  • RFC 7638 SHA-256 thumbprint for every key
  • Web Crypto API; keys never leave the browser
Read the guide: JSON Web Keys (JWK) Explained: Formats, JWKS and Thumbprints

Updated

How to use JWK Converter

  1. To convert a JWK, paste it (or a whole JWKS document) into the input box and click Convert to PEM. The PEM tab opens with the result.
  2. To convert a PEM key or certificate, paste it into the same box and click Convert to JWK. Private keys produce a public JWK plus a separate Private JWK box.
  3. To create a key, pick an algorithm from the list and click Generate JWK. The public JWK, the private JWK and both PEM forms appear in the output tabs.
  4. Copy or download each output. The RFC 7638 thumbprint appears under the input box after every operation.

Worked examples

RFC 7638 example key

Input

{"kty":"RSA","e":"AQAB","alg":"RS256","kid":"2011-04-29","n":"0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtV..."}

Output

Thumbprint NzbLsXh8uDCcd-6MNwXF4W_7noWXFZAfHkxZsRGC9Xs and a -----BEGIN PUBLIC KEY----- block

The thumbprint matches the value printed in section 3.1 of RFC 7638. The alg and kid members are ignored for both the thumbprint and the PEM.

Certificate to JWK

Input

A -----BEGIN CERTIFICATE----- block (for example the X.509 Parser sample)

Output

{"kty":"RSA","n":"ihm9oVmnVTyt...","e":"AQAB","kid":"<thumbprint>"}

The converter takes the SubjectPublicKeyInfo out of the certificate, so you can publish a certificate's key in a JWKS without running OpenSSL.

Background and insight

A JWK (RFC 7517) is a JSON object whose members describe a key. RSA keys carry n and e, EC keys carry crv, x and y, and Ed25519 or X25519 keys use kty "OKP" with crv and x (RFC 8037). Private keys add d, and RSA private keys add the CRT values p, q, dp, dq and qi. The base64url values are the same big-endian numbers that sit inside a PEM file; only the wrapping differs.

An RFC 7638 thumbprint hashes a canonical JSON form of just the required members, in lexicographic order with no whitespace, for example {"e":"AQAB","kty":"RSA","n":"..."}. Optional members such as alg, use or kid do not change it, which is why it works well as a key ID that two parties can compute independently.

Web Crypto refuses to import a JWK whose alg, use or key_ops conflict with the requested algorithm, a common source of "DataError" when converting keys from an identity provider. The converter strips those members before importing, then reports the key without them.

Common use cases

  • Verifying JWTs outside the identity provider

    Turn a key from an IdP's JWKS endpoint into PEM for libraries or tools that only accept PEM.

  • Publishing your own JWKS

    Convert the PEM public key your service signs with into a JWK, with a thumbprint-based kid for rotation.

  • Test fixtures

    Generate throwaway ES256 or Ed25519 key pairs for unit tests of JWT signing and verification.

  • Debugging kid mismatches

    Compute the thumbprint of a key to check it against the kid in a token header.

Tips and limitations

  • Generated private keys exist only in this tab. Copy them somewhere safe before leaving, and do not reuse test keys in production.
  • Do not paste production private keys into any web page you do not control. For production, generate keys inside your KMS or HSM and export only the public part.
  • Symmetric (kty "oct") keys have no PEM form; the converter says so instead of producing something misleading.
  • Encrypted PEM private keys must be decrypted first, for example with openssl pkey -in key.pem -out plain.pem.
  • Use the Digital Signature Validator to check that a signature verifies with a converted key.

Sources and further reading

  1. RFC 7517: JSON Web Key (JWK), IETF
  2. RFC 7518: JSON Web Algorithms (JWA), IETF. Key members for RSA and EC keys
  3. RFC 7638: JSON Web Key (JWK) Thumbprint, IETF
  4. RFC 8037: CFRG Elliptic Curve Diffie-Hellman (ECDH) and Signatures in JOSE, IETF. The OKP key type for Ed25519 and X25519
  5. SubtleCrypto: importKey() method, MDN Web Docs. How Web Crypto imports JWK, SPKI and PKCS #8 keys

Frequently asked questions

How do I convert a JWK to a PEM public key?

Paste the JWK into the input box and click Convert to PEM. The tool imports it with the Web Crypto API and exports the SubjectPublicKeyInfo as a -----BEGIN PUBLIC KEY----- block, which OpenSSL, Node.js, Java and most JWT libraries accept. A JWK Set produces one PEM block per key.

What is a JWK thumbprint and how is it calculated?

A JWK thumbprint (RFC 7638) is a hash that identifies a key. Take only the required members (e, kty, n for RSA; crv, kty, x, y for EC), serialise them as JSON in alphabetical order with no spaces, hash with SHA-256 and base64url-encode the result.

Why does Web Crypto throw DataError when I import my JWK?

Usually because alg, use or key_ops in the JWK disagree with the algorithm passed to importKey, for example alg PS256 imported as RSASSA-PKCS1-v1_5. A private RSA JWK without all CRT members also fails. This converter removes alg, use and key_ops before importing.

Can I convert a certificate into a JWK?

Yes. Paste the PEM certificate and click Convert to JWK. The tool reads the public key from the certificate and outputs it as a JWK with its thumbprint as kid. If you also need the x5c or x5t members, add them by hand from the certificate and its fingerprint.

Which algorithm should I generate for signing JWTs?

ES256 or EdDSA give small keys and signatures and are widely supported by modern libraries. RS256 remains the most compatible choice for older systems. PS256 uses RSA-PSS padding and is preferable to RS256 when every verifier supports it.

Is it safe to generate keys in a browser tab?

The keys come from the Web Crypto API, which uses the operating system's secure random generator, and they are never transmitted. They are fine for development and testing. For production signing keys, prefer a KMS or HSM so the private key never exists in a browser at all.

Is there an in-depth guide to JWK Converter?

Yes. “JSON Web Keys (JWK) Explained: Formats, JWKS and Thumbprints” covers the background, how it works, common pitfalls and worked examples. Read the full guide.