JWE Encrypt / Decrypt
EncryptionProcessed locally in your browser using the Web Crypto API. Nothing is sent to any server.
How It Works
This tool implements JWE (JSON Web Encryption) as defined in RFC 7516,
using compact serialization format. All cryptographic operations run locally in your browser via the
Web Crypto API — no data leaves your device.
JWE Compact Serialization
A JWE token has 5 Base64URL-encoded parts separated by dots:
BASE64URL(header) . BASE64URL(encrypted_key) . BASE64URL(iv) . BASE64URL(ciphertext) . BASE64URL(tag) - Header: JSON object specifying the key management algorithm (
alg) and content encryption algorithm (enc) - Encrypted Key: The content encryption key (CEK) wrapped by the chosen key management method
- IV: Random 96-bit initialization vector for AES-GCM
- Ciphertext: The encrypted payload
- Tag: 128-bit authentication tag ensuring integrity
Key Management Algorithms
- dir (Direct Key): The shared key IS the CEK — simplest, fastest, both sides must share the same secret
- RSA-OAEP-256: A random CEK is generated and encrypted with the recipient's RSA public key (SHA-256 OAEP padding)
- A128KW / A256KW: A random CEK is wrapped (encrypted) with a 128-bit or 256-bit AES key encryption key
Content encryption is always A256GCM (AES-256-GCM), providing both confidentiality and authenticated encryption — any tampering with the ciphertext is automatically detected.
Key Formats
Symmetric keys can be entered in three formats: UTF-8 (plain text), Hex (hexadecimal string), or Base64URL (URL-safe Base64 without padding). The tool validates the key length and shows the expected size for the selected algorithm.
JWT vs JWE
JWT (RFC 7519) signs a payload for integrity. JWE (RFC 7516) encrypts a payload for confidentiality. They can be combined: sign a JWT first, then encrypt it in a JWE (nested JWT). This tool detects nested JWTs in decrypted output and provides a one-click link to verify them.
Frequently Asked Questions
What is JWE?
JWE (JSON Web Encryption, RFC 7516) encrypts a JSON payload so that only the intended recipient can read it. It uses compact serialization: five Base64URL segments separated by dots — header, encrypted key, IV, ciphertext, and authentication tag.
What is the difference between JWT and JWE?
JWT provides integrity (signature) but not confidentiality — anyone can read the payload. JWE provides confidentiality — the payload is encrypted and only the key holder can decrypt it. They can be combined: sign a JWT first, then encrypt it inside a JWE (nested JWT).
Which key management algorithm should I choose?
Use "dir" (direct key) when both sides share a secret and can exchange it securely — simplest and fastest. Use "RSA-OAEP-256" when the recipient has an RSA key pair and you only have their public key — the CEK is generated randomly and wrapped with RSA. Use "A128KW" or "A256KW" when you need AES-level key wrapping with a pre-shared key encryption key.
What key formats are supported?
For symmetric algorithms (dir, A128KW, A256KW), you can enter the key as UTF-8 text, hexadecimal, or Base64URL. The tool validates the key length automatically — dir and A256KW need exactly 32 bytes, A128KW needs 16 bytes. For RSA-OAEP-256, paste a PEM-formatted public key (encrypt) or private key (decrypt).
What happens if I paste a JWE with a "Bearer" prefix?
The tool automatically strips the "Bearer " prefix before processing. This is common when copying a JWE token from an HTTP Authorization header. No manual cleanup needed.
Is the encryption done client-side?
Yes. All encryption and decryption happens locally in your browser using the Web Crypto API. No data, keys, or tokens are sent to any server.
What is the swap button for?
The swap button (↔) quickly switches between encrypt and decrypt modes while transferring the output to the input. Useful for verifying encryption by immediately decrypting the result, or when you paste a JWE token and want to switch to decrypt mode.
Privacy Note
This tool runs entirely in your browser. Your input is never uploaded, stored, or sent to any server.
Disclaimer: This tool is provided for educational and informational purposes only. The results do not constitute professional security advice. Use at your own discretion.