PEM to JWK Converter
Convert RSA or EC SPKI public keys between PEM and JWK with an RFC 7638 thumbprint
Handles RSA/EC public keys (SPKI PUBLIC KEY) only; private keys, certificates, and encrypted PEM are rejected.
The converted public key will appear here.
About this tool
PEM to JWK Converter translates RSA and P-256, P-384 or P-521 EC public keys between a single SubjectPublicKeyInfo PUBLIC KEY PEM block and a public JWK object. Input is limited to 1 MB. JWK integer and coordinate fields must use canonical unpadded Base64url; RSA n/e use minimal positive integer bytes, and EC coordinates retain their fixed width. Both directions export the imported public key before calculating its RFC 7638 SHA-256 thumbprint. Private members and policy metadata such as alg, use, key_ops and an existing kid are omitted. The generated thumbprint is a kid candidate, not proof of trust, ownership, permitted use or a certificate chain. Private, certificate, PKCS#1 RSA PUBLIC KEY and encrypted PEM containers are not supported.
Scenario Recipes
Prepare a verification key for a JWKS
Goal: Convert an existing SPKI public key without exposing its private counterpart
- Paste the BEGIN PUBLIC KEY PEM and convert it to JWK.
- Confirm kty, curve or modulus size, then record the RFC 7638 thumbprint.
- Add policy-specific alg, use, and kid metadata only after checking the consuming service requirements.
Result: A public-only JWK and deterministic key identifier candidate ready for controlled integration.
Production Snippets
Check SPKI public fields with Node.js
javascript
const { createPublicKey } = require('node:crypto');
const { readFileSync } = require('node:fs');
console.log(createPublicKey(readFileSync('public.pem')).export({ format: 'jwk' }));
// Expected: the same kty and RSA n/e or EC crv/x/y as this converter.
// Adding '=' to a JWK coordinate or modulus must be rejected here.Frequently Asked Questions
Which PEM block is supported?
The PEM input must be an unencrypted SubjectPublicKeyInfo block labeled BEGIN PUBLIC KEY.
Can it convert private keys?
No. Private parameters are never required or emitted; a JWK containing them is reduced to its public fields.
Which EC curves are supported?
Browser WebCrypto support is used for P-256, P-384, and P-521 public keys.
Why is RSA PUBLIC KEY rejected?
That label contains PKCS#1 rather than SPKI. Convert it to a standard PUBLIC KEY container in a trusted key-management workflow first.
What is the generated kid value?
It is an RFC 7638 SHA-256 JWK thumbprint and a deterministic candidate, not a mandatory identifier assigned by a server.
Is key material uploaded?
No. Import, export, public-field normalization, and thumbprint calculation use browser WebCrypto locally.
Why are padded or zero-prefixed RSA fields rejected?
RFC 7518 encodes RSA integers with the minimum unsigned bytes and RFC 7638 hashes their canonical JWK representation. Noncanonical spellings are rejected so the same imported public key does not acquire different claimed canonical thumbprints.
Will my alg, use, key_ops or existing kid survive conversion?
No. Conversion emits only public key material; policy metadata must be checked and restored for the consuming service. The displayed thumbprint is a separate deterministic identifier candidate.
Keep browsing