JWE Decrypt, Decode and Encrypt Online
Inspect, encrypt, and decrypt JSON Web Encryption tokens across the full JWA algorithm set.
About JWE Decrypt, Decode and Encrypt Online
JSON Web Encryption (JWE) is a standard defined in RFC 7516 for representing encrypted content using JSON-based data structures. While its sibling specification JWT (JSON Web Token, RFC 7519) provides integrity protection through digital signatures, JWE provides confidentiality by encrypting the payload so that only the intended recipient with the correct decryption key can read it. A JWE token in compact serialization consists of five Base64url-encoded parts separated by dots: the JOSE header, the encrypted key, the initialization vector, the ciphertext, and the authentication tag. Together, these components carry everything needed for the recipient to decrypt and verify the content.
JWE separates key management from content encryption through a two-layer architecture. The content encryption algorithm (specified by the "enc" header parameter) encrypts the actual payload using a random Content Encryption Key (CEK) with an authenticated encryption algorithm such as AES-128-GCM, AES-256-GCM, or AES-CBC with HMAC-SHA2. The key management algorithm (specified by the "alg" header parameter) then wraps or encrypts this CEK for the recipient using one of several strategies: direct encryption ("dir") where a shared symmetric key serves directly as the CEK, AES Key Wrap ("A128KW", "A256KW") where a symmetric key encrypts the CEK, RSA-OAEP where the recipient's RSA public key encrypts the CEK, or ECDH-ES where an ephemeral Elliptic Curve Diffie-Hellman agreement derives the key. This separation allows the same encrypted payload to be targeted at multiple recipients using different key types through JWE JSON serialization.
JWE is used in scenarios where the token payload must remain confidential rather than merely tamper-proof. OAuth 2.0 and OpenID Connect implementations use JWE to encrypt ID tokens and access tokens that contain sensitive claims such as personal information, authorization scopes, or session details that should not be visible to intermediaries or browser-side JavaScript. Financial services and healthcare APIs encrypt tokens carrying regulated data like account numbers or patient identifiers. Nested JWT structures combine JWS and JWE by first signing a JWT for integrity and then encrypting the signed token for confidentiality, providing both authentication and privacy in a single compact token.
How to Use the JWE Decrypt, Decode and Encrypt Tool
- To decode an existing JWE token, paste the compact serialization string (five dot-separated Base64url segments) into the Decode tab and the tool will parse and display the JOSE header, encrypted key, initialization vector, ciphertext, and authentication tag.
- To decrypt a JWE token, switch to the Decrypt tab and paste the token. The tool reads the "alg" and "enc" from the header and shows the matching key input automatically.
- For symmetric algorithms (dir, AES Key Wrap, AES-GCM Key Wrap), enter the key and choose its format (hex, Base64, Base64url, or UTF-8). For passphrase-based PBES2, type the passphrase. For RSA-OAEP and ECDH-ES, paste the recipient's private key as a PKCS#8 PEM or a JWK.
- To encrypt new content, switch to the Encrypt tab, enter your plaintext, and select the key management algorithm (dir, AES-KW, AES-GCMKW, RSA-OAEP, ECDH-ES, or PBES2) and content encryption algorithm (AES-GCM or AES-CBC-HMAC).
- Provide the encryption key, or use Generate Random Key (symmetric) or Generate Keypair (RSA/EC). When generating a keypair, copy the private key shown. You need it to decrypt the token later.
- Optionally enable Compress (DEFLATE) to set zip:"DEF" and compress the payload before encryption, and set the PBES2 iteration count when using a passphrase.
- Copy the resulting JWE token or decrypted plaintext using the copy button for use in your application, API testing, or security analysis.
Common Use Cases
Encrypting OAuth 2.0 and OpenID Connect Tokens
Identity providers issue JWE-encrypted ID tokens and access tokens when the token payload contains personally identifiable information (PII) such as email addresses, phone numbers, or authorization details that should not be readable by client applications, browser extensions, or network intermediaries. The authorization server encrypts the token with the resource server's public key so that only the intended API can decrypt and process the claims, even if the token is intercepted or logged in transit.
Securing Sensitive API Payloads
Financial services, healthcare, and government APIs use JWE to encrypt request and response payloads containing regulated data such as account numbers, Social Security numbers, medical records, or tax information. JWE provides application-layer encryption that protects the data independently of transport-layer security (TLS), ensuring confidentiality even if TLS is terminated at a load balancer, logged by an API gateway, or the data is stored in an intermediary cache.
Building Nested JWT Structures for Signed and Encrypted Tokens
Applications that require both integrity verification and confidentiality use a nested JWT pattern: first creating a JWS (signed JWT) to authenticate the issuer and protect against tampering, then encrypting the entire JWS as the payload of a JWE token. The recipient decrypts the outer JWE layer to obtain the signed JWT, then verifies the signature to confirm authenticity. This pattern is common in inter-service communication where both the sender's identity and the payload's secrecy must be guaranteed.
Debugging and Inspecting Encrypted Tokens During Development
During development and testing of systems that produce or consume JWE tokens, developers need to inspect the token structure, verify that the correct algorithms are being used, decrypt tokens to validate the plaintext payload, and generate test tokens with known content. This tool provides a browser-based environment for these tasks without requiring custom scripts, command-line tools, or exposing sensitive keys to third-party services, since all cryptographic operations run client-side via the Web Crypto API.
Frequently Asked Questions
What is the difference between JWE and JWS (or JWT)?
JWS (JSON Web Signature) provides integrity protection and authentication by digitally signing a payload, but the payload remains readable by anyone who possesses the token since it is only Base64url-encoded, not encrypted. JWE provides confidentiality by encrypting the payload so that only the holder of the correct decryption key can read it. JWT (JSON Web Token) is a higher-level format that can use either JWS for signed tokens or JWE for encrypted tokens. A JWS token has three dot-separated parts (header.payload.signature), while a JWE token has five (header.encryptedKey.iv.ciphertext.tag). When both integrity and confidentiality are needed, a nested JWT wraps a JWS inside a JWE.
Can I decode a JWE token without the key?
Only the parts that are not encrypted. The Decode tab splits the token into its five segments and shows the JOSE header, the alg and enc values, the key id (kid) when the header carries one, and the byte sizes of the encrypted key, initialization vector, ciphertext and authentication tag. None of that needs a key, because the header is only Base64url-encoded, not encrypted. The payload is different: it is ciphertext, and reading it requires the matching key in the Decrypt tab. Decoding a JWE never reveals the plaintext.
Which JWE algorithms (alg and enc) does this tool support?
The "alg" header parameter names the key management algorithm and "enc" names the content encryption algorithm. For alg, the tool supports direct encryption ("dir"), where a pre-shared symmetric key is used as the Content Encryption Key without wrapping; AES Key Wrap (A128KW, A192KW, A256KW), which wraps a random CEK with a symmetric key per RFC 3394; AES-GCM Key Wrap (A128GCMKW, A192GCMKW, A256GCMKW); RSA-OAEP, RSA-OAEP-256, RSA-OAEP-384 and RSA-OAEP-512, which encrypt the CEK with the recipient's RSA public key; ECDH-ES and ECDH-ES+A128KW, ECDH-ES+A192KW and ECDH-ES+A256KW, which derive the CEK from an Elliptic Curve Diffie-Hellman agreement; and PBES2-HS256+A128KW, PBES2-HS384+A192KW and PBES2-HS512+A256KW, which derive the wrapping key from a passphrase. For enc, it supports AES-GCM (A128GCM, A192GCM, A256GCM), which encrypts and authenticates in one operation, and AES-CBC with HMAC-SHA2 (A128CBC-HS256, A192CBC-HS384, A256CBC-HS512), which pairs AES-CBC with a separate HMAC. AES-GCM is the usual choice for new systems; AES-CBC-HMAC is kept for compatibility with older ones. RSA1_5 tokens can be decoded but not decrypted (see the RSA1_5 question), and every A192 variant is disabled in Chromium-based browsers (see the A192 question).
Is it safe to decrypt JWE tokens in the browser?
This tool performs all cryptographic operations client-side using the Web Crypto API, which means your tokens and keys are never transmitted to any server. The Web Crypto API provides hardware-backed cryptographic primitives implemented by the browser vendor, making it suitable for handling sensitive material in a client-side context. However, you should still exercise caution with production keys and tokens: avoid using production private keys in any web-based tool (including this one) in untrusted environments, and prefer generating test keys specifically for development and debugging purposes.
Why are the A192 algorithms disabled in my browser?
Algorithms that use a 192-bit AES key (A192GCM, A192KW, A192GCMKW, A192CBC-HS384, ECDH-ES+A192KW, and PBES2-HS384+A192KW) are not available in Chromium-based browsers (Chrome, Edge, Brave, Opera) because their underlying BoringSSL library omits 192-bit AES. The tool detects this at load time and disables those options. Firefox and Safari support the full 192-bit tier, so the same token will decrypt there. This is a browser platform limitation, not a property of the JWE token itself.
Does this tool support RSA1_5 and compressed (zip) tokens?
Compressed tokens are fully supported: a JWE with the zip:"DEF" header is decompressed on decryption (with a size cap that guards against decompression bombs), and you can produce compressed tokens with the Compress (DEFLATE) toggle. RSAES-PKCS1-v1.5 (alg "RSA1_5") can be inspected but not decrypted or encrypted, because the Web Crypto API deliberately removed PKCS#1 v1.5 encryption: it is vulnerable to Bleichenbacher padding-oracle attacks and is deprecated across the JOSE ecosystem. Prefer RSA-OAEP-256 instead.
Why does my JWE token fail to decrypt?
Decryption failures typically stem from one of several causes. The most common is a key mismatch: the decryption key does not correspond to the encryption key used to create the token. For RSA-OAEP, you must use the private key that corresponds to the public key used during encryption. For AES Key Wrap, the symmetric key must match exactly. For direct encryption, the key must be the correct length for the content encryption algorithm (16 bytes for A128GCM, 32 bytes for A256GCM). Other causes include algorithm mismatch (the tool's selected algorithm does not match the token's header), a corrupted or truncated token string, or a token that uses an unsupported algorithm variant.
When should I use JWE instead of relying solely on TLS for encryption?
TLS encrypts data in transit between two network endpoints, but it does not protect data at rest, in logs, in browser storage, or when TLS is terminated at an intermediary. JWE provides end-to-end encryption at the application layer, meaning the data remains encrypted regardless of how many network hops, proxies, load balancers, or storage systems it passes through. Use JWE when the token may be stored in browser localStorage or cookies readable by JavaScript, when tokens pass through API gateways or logging systems that should not see the payload, when regulatory requirements mandate application-layer encryption for specific data types, or when the token's recipient is different from the TLS endpoint.