JWT Decoder: Inspect JSON Web Token Header, Payload and Claims
Decode any JSON Web Token instantly in your browser. Inspect the header, payload claims, algorithm, and expiry without sending your token to a server.
What Is the JWT Decoder?
A JWT Decoder reads a JSON Web Token and displays its three parts — header, payload, and signature — in human-readable form. JSON Web Tokens are the dominant standard for passing authentication and authorisation information between services in modern web applications, mobile apps, and APIs.
A JWT is a compact, URL-safe string made of three Base64URL-encoded segments separated by dots. The header describes the token type and signing algorithm. The payload contains claims — structured key-value pairs that assert things about the user or session, such as user ID, email, roles, issue time, and expiry. The signature is a cryptographic value that lets a server verify the token was not tampered with.
Decoding a JWT reveals the claims without verifying the signature. This is useful during development and debugging: you can see what your identity provider is sending, check whether an expiry timestamp is correct, inspect custom claims your server reads for authorisation logic, and diagnose authentication failures without needing server-side logging.
calc-masters's decoder runs entirely in the browser. Your token is never sent to any server — it is decoded locally using the same Base64URL algorithm any client would use. This matters because JWTs often contain user identifiers, email addresses, and permission scopes that should not be transmitted unnecessarily.
Key Parameters & Input Variables
- Raw Compact JSON Web Token (3-Part JWS or 5-Part JWE): Accepts raw compact tokens or full HTTP Authorization: Bearer headers, Set-Cookie strings, and OAuth2 redirect URLs.
- Pure-TS FIPS 180-4 & RFC 2104 HMAC Signature Verifier (HS256 / HS384 / HS512): Evaluates HMAC(K, m) = H((K' ⊕ 0x5c) ∥ H((K' ⊕ 0x36) ∥ m)) using UTF-8, Hexadecimal, or Base64URL shared secrets with constant-time comparison.
- RFC 7519 §4.1.4 Temporal Chronology & Clock-Skew Leeway (Δ Seconds): Audits iat (Issued At), nbf (Not Before), exp (Expiration Time), and OIDC auth_time against configurable clock-skew tolerance Δ (0s–300s).
- 12-Vector RFC 8725 (BCP 225) & OWASP Security Audit Matrix: Evaluates alg:none, symmetric key length (<256/384/512 bits), jku/x5u/jwk header injection, kid path/SQL injection, missing exp/aud/iss/jti, and PII payload exposure.
- Interactive JWT Mint & Multi-Stack Verifier Code Generator: Signs live HS256, HS384, and HS512 tokens in-browser and outputs production verification code for Node.js (jose), Python (PyJWT), Go, Rust, and Web Crypto API.
Common Use Cases & Applications
- Checking what claims an identity provider is returning in a token during OAuth or OIDC integration.
- Diagnosing 401 Unauthorized errors by inspecting token expiry and audience claims.
- Verifying that custom claims (roles, permissions, tenant IDs) are correctly populated by your auth service.
- Debugging API gateway or middleware authentication failures by reading the raw token payload.
- Confirming the signing algorithm (HS256, RS256, ES256) matches what your server expects.
- Checking issued-at and not-before timestamps when debugging time-skew authentication issues.
Mathematical Formula
JWT decoding splits the token on dot separators to get three segments, then applies Base64URL decoding to the first two segments. Base64URL is a variant of standard Base64 that replaces + with - and / with _ to make the string safe for use in URLs and HTTP headers without percent-encoding.
Once decoded, the header and payload are parsed as JSON. The signature segment is not decoded into a readable value — it is a binary cryptographic output that can only be verified by a server holding the secret key or public certificate. Displaying the raw signature base64 string is sufficient for identifying which key was used to sign the token.
Timestamp claims (iat, exp, nbf) are Unix timestamps — seconds since January 1 1970 UTC — and are converted to human-readable dates for clarity. The expiry claim is compared against the current time to show whether the token is still valid.
Primary Governing Equation
JWS = B64URL(H) . B64URL(P) . B64URL(Sig); HMAC(K, m) = H((K' ⊕ opad) ∥ H((K' ⊕ ipad) ∥ m)); Valid(t) ⟺ (nbf − Δ ≤ t < exp + Δ); L_B64(n) = ⌈4n / 3⌉
IETF RFC 7519 JWT & RFC 7515 JWS compact serialization dissection, RFC 2104 / FIPS 180-4 HMAC-SHA256/384/512 cryptographic signature verification & minting, RFC 7519 §4.1.4 clock-skew temporal windowing, and RFC 8725 (BCP 225) security auditing.
Base64URL decode
segment → replace('-'→'+', '_'→'/') → pad to multiple of 4 → base64 decode → UTF-8 string → JSON.parse()
The two-step process to turn a JWT segment into a readable JSON object.
Expiry check
expired = current Unix time > exp claim
Compare the current timestamp in seconds to the exp claim value.
Step-by-Step Calculation Guide
- Step 1: Take the sample token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c. Splitting on dots gives three segments.
- Step 2: Decoding the first segment reveals the header: algorithm HS256 (HMAC-SHA256) and type JWT. Decoding the second reveals the payload: subject '1234567890', name 'John Doe', and issued-at timestamp 1516239022, which converts to January 18 2018.
- Step 3: The third segment is the signature, which cannot be decoded into meaningful data without the secret key. Its presence confirms the token was signed, but verifying the signature must happen server-side.
- Step 4: This kind of inspection is essential during development when wiring up authentication: you can confirm the right user ID and claims are present before writing any server-side validation logic.
Sensitivity Analysis & Edge-Case Behavior
Avalanche Effect on Signing Input: Flipping a single bit or changing one whitespace character in the JSON payload alters ~50% of the output bits in the HMAC-SHA256/384/512 signature digest, immediately invalidating the cryptographic MAC.
HMAC Key Entropy Threshold (RFC 7518 §3.2): Using a human-memorable passphrase (< 128 bits) instead of a 256-bit CSPRNG key allows an offline 8× RTX 4090 GPU cluster (~180 GH/s on HMAC-SHA256) to recover the signing key via dictionary or rule-based cracking without ever contacting your auth server.
Common Pitfalls & Errors to Avoid
- Using JSON.parse(atob(token.split('.')[1])) in backend authorization middleware without verifying the cryptographic signature first.
- Using JavaScript's standard atob() without replacing Base64URL '-' and '_' characters or decoding multi-byte UTF-8 sequences via TextDecoder.
- Trusting the header's jku, x5u, or embedded jwk parameter dynamically instead of resolving keys against a pinned server-side JWKS allowlist.
Institutional & Industry Applications
Identity & Access Management (IAM / OIDC): Debugging Auth0, Okta, Keycloak, AWS Cognito, and Azure Entra ID access and ID tokens.
API Gateway & Microservice Security: Validating audience (aud), issuer (iss), scope, and clock-skew tolerance across Envoy, Kong, andZero-Trust meshes.
Application Security & Penetration Testing: Auditing bearer tokens against IETF RFC 8725 (BCP 225) and OWASP API Security Top 10 standards.
Expert Tips & Best Practices
- Always pass an explicit algorithm allowlist (e.g., algorithms: ['RS256'] or ['ES256']) to your backend JWT verification library to block alg:none and RS256-to-HS256 key confusion attacks.
- Keep stateless access token TTLs short (5 to 15 minutes) and pair them with rotating, revocable refresh tokens and a unique jti (JWT ID) claim.
- Never store plaintext passwords, API secret keys, credit card numbers, or unencrypted PII inside a JWS payload—Base64URL is effortlessly readable by any client or proxy.
Frequently Asked Questions
What is the mathematical difference between decoding a JWT and verifying its cryptographic signature?
Decoding a JWT simply reverses the RFC 4648 §5 Base64URL encoding (L_B64 = ceil(4n/3)) of the first two dot-separated segments (Header and Payload) into human-readable UTF-8 JSON. Anyone who intercepts a JWS token can decode and read its claims without a secret key. Verifying a JWT recomputes the cryptographic signature (such as HMAC-SHA256 or RSA-PSS) over the exact ASCII signing input 'Base64URL(Header).Base64URL(Payload)' using a secret key or public key and compares the resulting byte array against the third segment in constant time to prove authenticity and integrity.
How does HMAC-SHA256 (HS256) compute a JWT signature, and what is the minimum secret key length required by RFC 7518?
Under RFC 2104 and FIPS 180-4, HMAC-SHA256 pads or hashes the secret key K to the 64-byte (512-bit) SHA-256 block size, XORs it with an inner pad (0x36 repeated 64 times) and outer pad (0x5c repeated 64 times), and computes H((K' XOR opad) || H((K' XOR ipad) || signingInput)). RFC 7518 Section 3.2 mandates that HMAC keys MUST be at least the size of the hash output: >= 256 bits (32 bytes) for HS256, >= 384 bits (48 bytes) for HS384, and >= 512 bits (64 bytes) for HS512 to prevent offline GPU dictionary brute-forcing.
How are JWT exp, nbf, and iat Unix timestamps validated with RFC 7519 clock-skew leeway?
JWT NumericDate claims (exp, nbf, iat, auth_time) represent integer seconds elapsed since the Unix Epoch (1970-01-01T00:00:00Z), excluding leap seconds. Because distributed microservices experience NTP clock drift, RFC 7519 Section 4.1.4 recommends applying a small clock-skew tolerance Δ (typically 30 to 120 seconds) so that a token is accepted at current epoch time t_now if and only if (nbf − Δ) <= t_now < (exp + Δ).
What are the 'alg: none' and RS256-to-HS256 algorithm confusion vulnerabilities in RFC 8725?
In the 'alg: none' bypass attack, an attacker modifies the JWT header to {"alg":"none"}, tampers with payload privileges (e.g., "role":"admin"), and strips the signature segment, exploiting naive parsers that trust the token's unverified header. In RS256-to-HS256 key confusion (CVE-2015-9235 / CVE-2016-10555), an attacker changes the header from asymmetric RS256 to symmetric HS256 and signs the forged token using the server's publicly available RSA public key bytes as the HMAC shared secret. RFC 8725 (BCP 225) mandates hardcoding an explicit algorithm allowlist in your backend verifier.