Security · Developer Guide
How to Decode and Debug JWT Tokens
A readable token is not a trusted token. Use decoding to investigate a login problem, then let the application verify the signature and claims before granting access.
What is a JWT?
A common signed compact JWT has three dot-separated segments: a header, a payload, and a signature. The first two use Base64URL-encoded JSON. Encryption uses a different representation; the decoder here accepts three non-empty segments, not encrypted five-segment tokens.
How to inspect a token
- Paste the token itself, without the Authorization: Bearer prefix, into JWT Decoder.
- Inspect header fields such as alg and kid to identify the intended algorithm and key lookup. Treat those fields as untrusted input.
- Inspect payload fields such as iss, aud, sub, exp, and nbf against the application's documented expectations.
- Check the server clock and configured clock tolerance. The local expiration checker uses your device clock and does not verify a signature.
Example: diagnose an expiry mismatch
Suppose a decoded payload contains the following claims. The exp value describes 2025-01-01T01:00:00Z. A milliseconds-based comparison with that raw number would make the token appear expired far too early.
{
"sub": "demo-user",
"aud": "example-api",
"exp": 1735693200
}
JavaScript comparison:
Date.now() / 1000 >= payload.expCommon mistakes
- Using a standard Base64 decoder on the whole token: split the segments and account for Base64URL's alphabet and padding rules. The JWT Decoder handles this for you.
- Treating an unexpired token as valid: the issuer, audience, signature, and other application rules still need checking.
- Assuming decoded fields are secret: signed payloads can be read by anyone who possesses the token.
- Changing exp locally: editing a claim changes the signed data and invalidates the original signature.
Practical use cases
When one service rejects a token accepted by another, compare their expected issuer and audience, then inspect the selected verification key and algorithm on the server. When expiry differs between environments, compare clocks and units before changing token lifetimes.
Security considerations
Small Tools displays decoded claims and explicitly reports that the signature is not verified. Never use its output as an authorization decision. Use a maintained JWT verification library in the application, with expected algorithms, issuer, and audience configured by trusted application settings.
Processing is local to your browser. A real access token may still grant access if copied into a chat, issue, screenshot, or clipboard history. Prefer fabricated or expired diagnostic tokens and redact sensitive claims before sharing.
Run it yourself
The token below was built for this guide: its payload is the claim set from the example above, and it was signed with the throwaway secret demo-secret-not-real. Paste it into JWT Decoder to see the header and payload and the line Signature: not verified. JWT Expiration Checker reports Expires at: 2025-01-01T01:00:00.000Z and Status: Expired, because that time has passed. JWT Header Decoder shows the header alone.
The decoder rejects input that is not a compact three-segment token: two segments, five segments, and a value that still has the Bearer prefix are all errors (the prefix is reported as an invalid Base64URL segment). A token whose payload has no numeric exp is reported by the expiration checker. The Node.js v26.12.1 block shows why editing a claim does not work: the same signature fails to verify once exp changes.
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkZW1vLXVzZXIiLCJhdWQiOiJleGFtcGxlLWFwaSIsImV4cCI6MTczNTY5MzIwMH0.yp5iWQsnCeylNQwb2PrvctX_GmqV8-cOmbeLsaPwYuI
// HS256 check with the demo secret "demo-secret-not-real"
verify(original token) // true
verify(same token, exp changed to 9999999999) // false
// seconds vs milliseconds, for exp = 4102444800 (2100-01-01T00:00:00Z)
Date.now() >= 4102444800 // true (wrong: milliseconds compared with seconds)
Date.now() / 1000 >= 4102444800 // false (correct: the token has not expired)What this guide does not verify
- Signatures. The tools never check one, and nothing in this guide proves that a token is genuine.
- Issuer, audience, key selection and algorithm rules. Your application must enforce them with trusted configuration.
- Encrypted tokens (JWE). The decoder accepts three non-empty segments only.
- Token revocation, rotation and lifetime policy, and the clock tolerance of your server.
Frequently asked questions
Can I trust a token because the decoder shows readable claims? No. Anyone can write a token that decodes cleanly. Only a signature check with a key you trust, plus the expected issuer and audience, establishes that the claims are genuine.
What does alg none mean? RFC 7519 defines unsecured JWTs with no signature, and RFC 8725 warns that some libraries trusted an attacker-supplied none algorithm. The decoder shows such a header without complaint, so treat alg as untrusted input and configure the expected algorithms in your verifier.
Why is exp in seconds? RFC 7519 defines NumericDate as seconds since 1970-01-01T00:00:00Z, ignoring leap seconds. Compare it with Date.now() / 1000, not Date.now().
Related tools
- JWT Decoder — Decode a JWT header and payload without verifying its signature.
- JWT Header Decoder — Decode the protected header segment of a JWT locally.
- JWT Expiration Checker — Read a JWT exp claim and compare it with the current time.
- Unix Timestamp Converter — Convert Unix timestamps in seconds or milliseconds to readable dates.