JWT Decoder

Decode JWT tokens showing header, payload, and signature with expiry check

About JWT Decoder

A JWT (JSON Web Token) decoder splits a JWT into its three parts — header, payload, and signature — and displays each as formatted JSON. It also checks whether the token is expired based on the `exp` claim. Use this tool to inspect tokens during development and debugging without writing any code.

  • ✓Decodes the header, payload, and signature sections of any JWT
  • ✓Highlights token expiry: shows whether the token is still valid or has expired
  • ✓Displays all standard claims (iss, sub, aud, exp, iat, jti) with human-readable timestamps
  • ✓Works with any JWT regardless of the signing algorithm (HS256, RS256, ES256, etc.)

How JWTs Work — A Practical Breakdown

A JSON Web Token packs identity and authorization data into a compact, URL-safe string that can be passed in an HTTP header, a cookie, or a query parameter. Understanding its three-part structure makes debugging authentication issues dramatically faster — you stop guessing and start reading.

The three parts, decoded

eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0IiwibmFtZSI6IkFsaWNlIn0.SflKxw...
└──────── header ────────┘└──────────── payload ────────────┘└── signature ──┘

Header  → { "alg": "HS256", "typ": "JWT" }
Payload → { "sub": "1234", "name": "Alice", "iat": 1699000000 }
Signature → HMACSHA256(base64(header) + "." + base64(payload), secret)

Each segment is separately Base64URL-encoded, then joined with dots. Decoding the header and payload requires no secret — that is exactly what this tool does. The signature is the only part that requires a key, which is why "decoding" and "verifying" a JWT are different operations.

Decoding vs. verifying — a critical distinction

  • ·Decoding reveals the claims inside a token — anyone can do this with nothing but the token string, since Base64URL is an encoding, not encryption
  • ·Verifying confirms the token was issued by a trusted party and has not been tampered with — this requires the signing secret (HMAC algorithms) or the issuer's public key (RSA/ECDSA algorithms)
  • ·A token can decode perfectly and still be a forgery — decoding tells you what a token claims, verification tells you whether to trust those claims

Tip: Never make an authorization decision based on a decoded-but-unverified JWT. An attacker can craft a payload claiming "role: admin" — only signature verification with the correct key proves the token actually came from your auth server.

Reading the expiry and timing claims

The `exp`, `iat`, and `nbf` claims are Unix timestamps (seconds since 1970-01-01). This tool converts them to human-readable dates and flags whether a token is currently valid, but it is worth knowing the raw format when you are debugging in a terminal or log file:

// Convert a JWT timestamp claim to a readable date
new Date(1699000000 * 1000).toISOString()
// → "2023-11-03T08:26:40.000Z"

// Quick "is it expired" check
const isExpired = (exp) => Date.now() >= exp * 1000

Common things to check when debugging auth issues

  • ·Algorithm mismatch — the `alg` in the header must match what your verification library expects; a server expecting RS256 will reject an HS256 token even if the payload looks correct
  • ·Clock skew — if `iat` or `nbf` is slightly in the future relative to the verifying server's clock, the token may be rejected; most libraries allow a small leeway window for this
  • ·Audience and issuer mismatches — `aud` and `iss` must match the values your server expects, which is a common source of "valid but rejected" tokens in multi-service setups
  • ·Missing or wrong claims — confirm the payload actually contains the fields your application code expects to read (e.g., `sub`, `email`, `roles`)

Tip: Treat real JWTs like passwords. They are bearer tokens — anyone holding one can use it. Avoid pasting production tokens into any third-party tool, including this one, unless you are working with test data or the token has already expired.

Frequently Asked Questions

Ad