Skip to content
Jellykit

JWK to PEM Converter

Convert RSA, EC and Ed25519 keys between JSON Web Key and PEM, in both directions, with the public key or the whole pair.

  • Runs on your device
Loading tool

About JWK to PEM Converter

Paste a JSON Web Key or a JWK Set and get PEM blocks that OpenSSL, nginx or a Java keystore can read; paste a PEM key, or a certificate, and get the JWK an OAuth or JOSE library expects. The direction is detected from what you paste.

RSA, the elliptic curves P-256, P-384, P-521 and secp256k1, and Ed25519, X25519, Ed448 and X448 are supported. Private keys can be written as PKCS #8 or in the older PKCS #1 and SEC 1 forms, or reduced to their public half so you can share them. Keys never leave your browser.

How it works

  1. A JWK’s Base64url members are decoded and written as the DER structures OpenSSL uses: SubjectPublicKeyInfo for public keys, PKCS #8 for private keys, or PKCS #1 and SEC 1 when you ask for the older style. The result matches what OpenSSL writes, byte for byte.
  2. A PEM block is read the other way: the structure is parsed, the key type is found from its algorithm identifier, and the numbers become JWK members. From a certificate, the public key is taken.
  3. Some private key files leave out the public half (Ed25519 PKCS #8 files usually do). The JWK format needs it, so it is computed with your browser’s Web Crypto, which current browsers can do for P-256, P-384, P-521, Ed25519 and X25519. Where a browser cannot, the tool says so.
  4. With “Add key ID”, kid is set to the key’s RFC 7638 thumbprint: the SHA-256 of its required public members, which any JOSE library can reproduce.

Questions

Can it read a passphrase-protected key?

No. A key in an ENCRYPTED PRIVATE KEY block, or an old-style file with Proc-Type: 4,ENCRYPTED, is refused with a message. Decrypt it first with openssl pkey, then paste the result.

Which PEM style should I pick?

PKCS #8 (BEGIN PRIVATE KEY) and SPKI (BEGIN PUBLIC KEY) are what current software expects. Choose PKCS #1 / SEC 1 (BEGIN RSA PRIVATE KEY, BEGIN EC PRIVATE KEY) only for older tools that ask for it. Ed25519 and X25519 have only the PKCS #8 form.

Why is an Ed448 private key refused?

Ed448 and X448 private key files normally hold only the private half, and a JWK must include the public one. Browsers cannot compute it for these curves, so the tool says so instead of writing an incomplete key. Their public keys convert normally.

Is it safe to paste a private key here?

The conversion runs entirely in this page; nothing is uploaded or stored. As with any private key, paste it only on a device you trust, and clear the page when you are done.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.