JWT Decoder & Tool — Decode JSON Web Tokens Privately

Zero-Server JWT Inspector 100% Local Only
Encoded Token
Drop file anywhere on box
Segment Visualizer
Awaiting input…
Total Length 0
Payload Size 0 B
Structure 0 parts
Decoded Claims & Verification Idle
Header (Algorithm & Token Type)
// Awaiting input...
Payload (Claims Set)
// Awaiting input...
Signature Segment
// Awaiting input…
Awaiting key input for verification
Copied to clipboard!

JSON Web Token (JWT) Security, Architecture, and Cryptography

JSON Web Tokens (JWTs), standardized under IETF RFC 7519, are the dominant mechanism for modern identity propagation, API authorization, and federated Single Sign-On (SSO) systems. Unlike traditional stateful session models where clients hold an opaque cookie mapping to a database record on a centralized cluster, a JWT is a stateless, digitally signed data structure that encapsulates authorization claims directly within the payload.

While stateless identity tokens simplify load balancing and horizontal scaling across microservices, they shift significant security responsibilities to application developers. A failure to understand token structure, signature validation routines, and transport safety can expose an entire enterprise network to credential theft, elevation-of-privilege exploits, and account takeovers.

1. An Architectural Breakdown: The Three Token Segments

A serialized compact JWT consists of three separate segments concatenated by literal ASCII periods (.):

Header.Payload.Signature

A. The JOSE Header (RFC 7515)

The JSON Object Signing and Encryption (JOSE) Header describes the cryptographic metadata necessary to parse and verify the token. Key parameters include:

  • typ: The Media Type. In standard authentication scenarios, this is set to “JWT” to prevent cross-protocol confusion when handling heterogeneous cryptographic objects.
  • alg: The Cryptographic Algorithm. Dictates the mathematical scheme used to generate the signature. Common standards are symmetric algorithms (HS256, HS384, HS512) and asymmetric public-key systems (RS256, ES256, PS256).
  • kid: Key ID. An identifier indicating which key in a JSON Web Key Set (JWKS) was used to sign the token, enabling seamless key rotation.

B. The Claims Set (Payload)

The payload contains claims—assertions made about an entity (typically the authenticated user or machine client) and supplementary authorization metadata. RFC 7519 categorizes claims into three namespaces:

  • Registered Claims: A reserved set of standardized, compact keys recommended for interoperability:
    • iss (Issuer): The identity provider or authorization server URI that generated the token.
    • sub (Subject): The unique identifier of the user or system principal represented by the token.
    • aud (Audience): The intended resource server or API endpoint for the token. Backends must reject tokens not intended for them.
    • exp (Expiration Time): The Unix epoch timestamp after which the token is invalid.
    • nbf (Not Before): The earliest Unix epoch timestamp at which the token may be processed.
    • iat (Issued At): The timestamp recording when the identity provider minted the token.
    • jti (JWT ID): A unique cryptographic nonce used to identify and revoke individual tokens.
  • Public Claims: Custom claims defined by organization developers that must be collision-resistant (often namespaced as URIs or registered via the IANA JSON Web Token Claims Registry).
  • Private Claims: Bespoke claims created to share authorization context between private backend services (e.g., tenant_id, permissions, org_role).

C. The Digital Signature

The signature is computed over the Base64URL-encoded header and payload. It ensures message integrity and non-repudiation:

Signature = Sign(Base64URL(Header) + “.” + Base64URL(Payload), secret_or_private_key)

2. Encoding vs. Encryption: Why Standard JWTs Are NOT Confidential

Critical Security Principle: Standard JSON Web Tokens are signed (JWS), not encrypted (JWE). Base64URL encoding is a public transport format, not an encryption mechanism.

A frequent architectural blunder involves storing sensitive corporate assets—such as raw passwords, Social Security numbers, unencrypted personal identifying information (PII), or database connection strings—directly in a JWT payload under the mistaken assumption that Base64URL cannot be read.

Anyone who intercepts a standard JWT can immediately inspect every claim in the payload using standard command-line tools or browser decoders. If payload confidentiality is strictly required, engineers must implement JSON Web Encryption (JWE, RFC 7516), which encrypts the payload into ciphertext before signing.

3. The Dangers of Server-Side JWT Decoders

Many popular online JWT utilities transmit pasted tokens over HTTP POST requests to third-party cloud servers for decoding. In an enterprise environment, this represents an acute threat vector:

  1. Token Interception & Session Hijacking: Active bearer tokens grant full authenticated API access. Sending them to third-party endpoints exposes them to access logs, corporate proxy caches, and rogue network tools.
  2. Regulatory & Compliance Violations: Sending tokens containing user identities, internal network paths, or customer credentials to unvetted cloud tools directly violates GDPR (Article 32), HIPAA, SOC 2, and PCI-DSS data boundaries.
  3. Zero-Server Assurance: This application executes 100% inside your local browser memory using native JavaScript (TextDecoder, atob, and the native W3C crypto.subtle API). No network packets are dispatched, no telemetry is gathered, and no external code is loaded.

4. Top 7 Critical JWT Vulnerabilities & Attack Vectors

Vulnerability Exploitation Mechanism Defensive Hardening Strategy
The “alg: none” Exploit An attacker changes the header to "alg": "none", strips the signature bytes, modifies authorization scopes in the payload, and sends it to a naive backend parser. Explicitly whitelist acceptable algorithms on the backend (e.g. ['RS256']). Reject any token with alg: "none" unconditionally.
Algorithm Confusion (RS256 to HS256) An attacker changes the algorithm from asymmetric RS256 to symmetric HS256, then signs the forged token using the server’s publicly available RSA public key as an HMAC secret. Never rely on the token’s header to determine the verification key or algorithm. Hardcode the expected algorithm inside backend verification middleware.
Weak HMAC Secrets Signing tokens with dictionary words or short passwords allows attackers to crack the HMAC secret offline using tools like Hashcat. Ensure symmetric secrets have at least 256 bits of cryptographically random entropy (32+ bytes generated by a CSPRNG), or migrate to asymmetric RSA/ECDSA keypairs.
Missing Expiration Claims (exp) Tokens issued without an exp claim remain valid forever unless the backend implements an out-of-band distributed blocklist. Mandate the presence of the exp claim. Enforce short lifespans (5 to 15 minutes) and issue rotating refresh tokens for long-lived sessions.
Replay Attacks A valid token intercepted over public Wi-Fi or compromised logs is re-transmitted by an attacker to impersonate the victim. Enforce TLS exclusively. Utilize unique jti claims with distributed memory stores (Redis) to reject duplicate token submissions.
XSS Storage Leakage Storing tokens in browser localStorage or sessionStorage makes them readable by any malicious third-party script injected via Cross-Site Scripting (XSS). Store tokens exclusively in hardened HttpOnly, Secure, SameSite=Strict or SameSite=Lax cookies inaccessible to JavaScript.
Clock Drift Failures Slight time differences between issuing and verifying servers cause tokens to be rejected immediately due to premature nbf or expired exp checks. Configure an explicit clock skew tolerance (e.g., 60 seconds) inside your JWT verification libraries.

5. Client-Side Cryptographic Verification via the Web Crypto API

This inspector features client-side cryptographic verification using the W3C Web Cryptography API (window.crypto.subtle). Web Crypto enables web browsers to execute high-performance, hardware-accelerated cryptographic operations locally without third-party libraries.

  • HMAC Verification (HS256, HS384, HS512): The raw secret is encoded as a byte array and imported into a non-extractable CryptoKey via crypto.subtle.importKey(‘raw’, …). The token’s signature is verified against the UTF-8 bytes of header + “.” + payload.
  • Asymmetric RSA & ECDSA Verification (RS256, ES256, etc.): The application parses standard PEM or X.509 certificates (.pem, .crt, .pub), strips the ASCII armor, converts the Base64 DER payload into an ArrayBuffer, and imports it as a SubjectPublicKeyInfo (SPKI) key. The digital signature is validated against the payload without exposing key material over the network.

6. Production Hardening Checklist for Engineers

  • Hardcode Verification Algorithms: Never rely on the header alg parameter. Explicitly declare jwt.verify(token, pubKey, { algorithms: [‘RS256’] }).
  • Enforce Audience and Issuer Validation: Always verify that the aud claim matches your microservice domain and that iss matches your identity provider.
  • Automate Key Rotation via JWKS: Distribute public keys through a TLS-secured /.well-known/jwks.json endpoint. Cache keys locally to avoid denial-of-service vulnerabilities.
  • Defense-in-Depth Revocation: Because stateless JWTs cannot be invalidated before expiration without server tracking, maintain an active token version counter or user-revocation timestamp in your database to invalidate active tokens instantly upon password changes.

7. Frequently Asked Questions (FAQ)

Q: What file formats are supported for file upload and drag-and-drop?
A: You can drag and drop or upload any text-based file, including .txt, .jwt, .env, or .json files. The tool scans configuration files and extracts the token string automatically if it matches standard JWT formatting (eyJ…).

Q: Is my public certificate or secret uploaded to a server for verification?
A: No. Signature verification executes locally inside your browser using the native Web Cryptography API. Keys, certificates, and tokens never touch an external server.

Q: Why does my signature show as “Invalid” for RS256 even though the token is authentic?
A: RS256 verification requires the exact public key corresponding to the private key that signed the token. Ensure you provide the public key in standard SubjectPublicKeyInfo (SPKI) PEM format (beginning with —–BEGIN PUBLIC KEY—– or —–BEGIN CERTIFICATE—–).