PEM / JWK Key Converter

Convert RSA and EC keys between PEM and JWK in both directions. PEM to JWK accepts PKCS#8, PKCS#1, SPKI, and SEC1; JWK to PEM outputs SPKI for RSA public keys, PKCS#1 for RSA private keys, SPKI for EC public keys, and SEC1 for EC private keys. Supports P-256, P-384, and P-521 locally.

FreeOnline Tool
Loading…

Rate this tool

Your rating helps others decide whether this tool is worth using

How to Use

  1. Choose the direction: PEM to JWK or JWK to PEM.
  2. Paste the key into the input box, or click Load sample data to fill in a built-in example.
  3. Click Convert. On success the output appears with the detected key type (for example RSA public key or EC private key (P-256)).
  4. Click Copy result to copy the output, or Clear to start over.

Limits: encrypted private keys (BEGIN ENCRYPTED PRIVATE KEY) and symmetric keys (kty=oct) are not supported. EC support covers only P-256, P-384, and P-521, and EC public keys in PEM must use the uncompressed form (first byte 0x04). An EC private key without public coordinates (x/y) cannot be converted to JWK.

Features

  • Two-way conversion between PEM and JWK; switching modes clears the input and output.
  • PEM to JWK: RSA public keys produce kty/n/e; RSA private keys add d/p/q/dp/dq/qi; EC public keys produce kty/crv/x/y; EC private keys add d.
  • PEM input covers RSA SPKI, PKCS#1, and PKCS#8, plus EC SPKI, PKCS#8, and SEC1.
  • JWK to PEM uses fixed output formats: SPKI for RSA public keys, PKCS#1 for RSA private keys, SPKI for EC public keys, and SEC1 for EC private keys.
  • Supports the P-256, P-384, and P-521 NIST curves; the curve is read from the key or taken from the JWK crv field.
  • Successful conversions report the key type; failures give a specific reason such as an unsupported PEM type, missing parameter, or coordinate length mismatch.
  • All DER encoding and decoding happens locally in the browser; keys are never uploaded.

Use Cases

Turn a JWK from a JWKS into PEM
When integrating OIDC, JWT verification, or payment APIs, convert a JWK from the JWKS into PEM for OpenSSL or server configuration.
Turn an OpenSSL-generated PEM into JWK
Convert a locally generated RSA or EC key into JWK JSON for an identity platform or configuration that requires JWK.
Cross-check key parameters between systems
Round-trip the same key between PEM and JWK to confirm that n/e/d or x/y/d parameters stay consistent during a system migration.
Teach RSA and EC key structure
Use conversion output to show RSA n/e/d/p/q parameters and EC crv/x/y/d parameters, illustrating how PEM maps to JWK.

FAQ

Which PEM and JWK formats are supported?
PEM public keys: SPKI (BEGIN PUBLIC KEY) and RSA PKCS#1 (BEGIN RSA PUBLIC KEY). Private keys: PKCS#8 (BEGIN PRIVATE KEY), RSA PKCS#1 (BEGIN RSA PRIVATE KEY), and EC SEC1 (BEGIN EC PRIVATE KEY). JWK input supports kty=RSA and kty=EC.
Why are encrypted private keys and kty=oct not supported?
BEGIN ENCRYPTED PRIVATE KEY is a password-encrypted PKCS#8 container that must be decrypted before its structure can be read. kty=oct is a symmetric key with no matching RSA/EC PEM structure, so the tool reports an error instead of producing invalid output.
What does JWK to PEM output?
RSA public keys are written as SPKI (BEGIN PUBLIC KEY), RSA private keys as PKCS#1 (BEGIN RSA PRIVATE KEY), EC public keys as SPKI, and EC private keys as SEC1 (BEGIN EC PRIVATE KEY).
Why does an EC private key report missing public key information?
A JWK needs the x and y coordinates for the public part, but some SEC1/PKCS#8 EC private keys store only the private scalar d and omit the public point. Use a complete private key that includes the public key, such as the default SEC1 output from OpenSSL.
Which EC curves are supported, and are compressed public keys accepted?
Only P-256, P-384, and P-521 are supported (other curves such as secp256k1 are not). EC public keys in PEM must be uncompressed, with a first byte of 0x04; compressed points cannot be parsed.
Are keys uploaded?
No. Conversion runs entirely in the browser, makes no network requests, and does not save keys to storage.