JWK ↔ PEM Converter

JWK to PEM & PEM to JWK RSA Key Converter

Convert JSON Web Keys (JWK / JWKS) to PKCS#8 PEM format and extract public/private RSA key components securely in browser.

JWK / JWKS Input
456 characters
PEM Formatted Output
SPKI Public
Format:
JWT Verification & JWKS Route Integration Code
// Verify JWT using Node.js jsonwebtoken
const jwt = require('jsonwebtoken');

const publicKey = `-----BEGIN PUBLIC KEY-----
...
-----END PUBLIC KEY-----`;

function verifyToken(token) {
  try {
    const decoded = jwt.verify(token, publicKey, {
      algorithms: ['RS256'],
    });
    console.log('Token successfully verified:', decoded);
    return decoded;
  } catch (err) {
    console.error('JWT Verification failed:', err.message);
    throw err;
  }
}

Zero-Knowledge Local Execution

All data processing, parsing, and compilation execute strictly inside your local browser memory. Zero external server uploads.

Instant Local Cryptography

Instant real-time reactive computation delivers immediate feedback on every keystroke with zero network latency.

Production Standards & Compliance

Follows modern browser Web Crypto and security practices for safe client-side inspection.

Technical Reference & Architecture Guide

JWK and PEM Cryptographic Key Format Technical Reference

Comprehensive technical cheatsheet for converting between JSON Web Key (RFC 7517) and PEM/DER formats (RFC 7468) for RSA and EC tokens.

JWK and PEM Cryptographic Key Format Technical Reference — Client-Side In-Memory Architecture & Data Flow
JWK and PEM Cryptographic Key Format Technical Reference — Client-Side In-Memory Architecture & Data Flow

Key Parameters & Controls

Key Parameters & Controls
ParameterType / UnitDescriptionDefault
ktystring ('RSA' | 'EC' | 'oct')Key Type parameter identifying the underlying cryptographic family.—
nstring (Base64URL)The RSA public modulus represented as an unsigned big-endian integer.—
estring (Base64URL)The RSA public exponent, commonly AQAB (65537).—
dstring (Base64URL, private only)The RSA private exponent required for digital signatures and decryption.—

Pro Tips & Best Practices

JWK values utilize Base64URL encoding

JWK values utilize Base64URL encoding (without '=' padding, '-' instead of '+', '_' instead of '/'). Standard Base64 strings will fail to parse.

When verifying JWTs issued by identity

When verifying JWTs issued by identity providers (Auth0, Okta, Firebase), retrieve the public key from the /.well-known/jwks.json endpoint.

Standard PEM public keys use

Standard PEM public keys use the SubjectPublicKeyInfo (SPKI) header '-----BEGIN PUBLIC KEY-----', whereas PKCS#1 uses '-----BEGIN RSA PUBLIC KEY-----'.

Common Gotchas & Troubleshooting

⚠️Error: Invalid Base64URL string in modulus 'n'

Ensure the modulus string contains only alphanumeric characters, hyphens, and underscores, with no trailing '=' padding or newline characters.

⚠️Token verification fails with 'Invalid Key Format'

Ensure you are using the public key (SPKI format) for signature verification and that the 'alg' claim matches (e.g., RS256).

Frequently Asked Questions

What is the difference between JWK and PEM format?▼

JWK (RFC 7517) represents cryptographic keys as JSON objects suitable for web APIs. PEM (RFC 7468) encapsulates DER-encoded ASN.1 binary structures within Base64 armoring.

Can I convert multiple keys from a JWKS endpoint?▼

Yes. When you paste a full JWKS JSON containing a 'keys' array, the converter extracts and converts each key individually.

Are private RSA keys safe to convert on ToolsAA?▼

Yes. All ASN.1 byte serialization and Web Crypto imports occur 100% client-side in memory. No network requests are ever made.

What are the common RSA modulus sizes supported?▼

The converter supports 2048-bit, 3072-bit, and 4096-bit RSA keys compliant with NIST and RFC standards.