JWK to PEM converter
Convert an RSA or EC key between JWK and PEM in either direction, public or private, using Web Crypto in your browser. The key is never sent anywhere.
RSA keys, and EC keys on P-256, P-384 and P-521, public or private. Converted in your browser; the key is not sent anywhere.
The result appears here.A public key becomes “BEGIN PUBLIC KEY” (SPKI), a private key “BEGIN PRIVATE KEY” (PKCS#8). The JWK output holds the key material only: add kid, use or alg yourself if your system expects them.
Everything you type here stays in your browser. Nothing is sent to HardenKit or to anyone else.
How to use the JWK to PEM converter
- Choose the direction: JWK to PEM, or PEM to JWK.
- Paste the key, or press Load an example to see a public RSA key.
- Read the result. It appears as soon as the key is valid.
- Copy it, and add kid, use or alg to a JWK yourself if you need them.
About this tool
JWK and PEM are two ways to write the same key. A JSON Web Key is a JSON object: for RSA the modulus n and exponent e, for an elliptic curve key the curve and the point x and y, each in Base64URL. It is what identity providers publish at their JWKS endpoints. PEM is the Base64 block between BEGIN and END lines that OpenSSL, web servers and most language libraries expect.
You need to convert when the two worlds meet: verifying a JWT with a library that wants a PEM public key when the issuer publishes JWKs, or publishing your own PEM key as a JWK. This tool imports the key with your browser’s Web Crypto and exports it in the other format. Public keys become SPKI, the BEGIN PUBLIC KEY block, and private keys become PKCS#8, BEGIN PRIVATE KEY. It handles RSA and the curves P-256, P-384 and P-521.
Only the key material is converted. Fields such as kid, use and alg are not part of the key and are left out of the JWK it produces; add them if your system looks keys up by ID. The older PEM types BEGIN RSA PRIVATE KEY and BEGIN EC PRIVATE KEY are not accepted by browsers, and the tool shows the OpenSSL command that converts them. Be careful with private keys: this page sends nothing, but a production key should not be pasted around.
Sources
Questions
Open the JWKS URL, find the key whose kid matches the kid in your token’s header, copy that one object from the keys array and paste it here. The result is a PEM public key you can give to a JWT library to verify signatures.
PKCS#1 is RSA-only and has the headers BEGIN RSA PRIVATE KEY and BEGIN RSA PUBLIC KEY. PKCS#8 holds a private key of any algorithm (BEGIN PRIVATE KEY), and SPKI holds a public key of any algorithm (BEGIN PUBLIC KEY). Web Crypto reads and writes the last two only.
They are metadata about how a key is used, not part of the key, and a PEM file does not contain them. The converter outputs kty and the key values only. Add a kid of your choosing, and use or alg if consumers of your JWKS expect them.
The conversion happens in your browser and the page makes no request with the key. The remaining risk is the clipboard and whatever else runs in your browser. For a production private key, prefer a local command, such as a short script with your language’s JOSE library.
No. This converter handles RSA keys and EC keys on the NIST curves P-256, P-384 and P-521. For other key types it says so and stops, so it does not hand back a wrong result.