Skip to content
ZeroKit
guide6 min readยท

What a JWT decoder can and cannot tell you

Paste a token into any decoder and you get readable JSON. That is useful and also dangerous, because readable is not the same as trustworthy. Here is what each part of a JWT actually proves.

01The three parts, and what each one is for

A JWT is three base64url-encoded segments joined by dots: header.payload.signature. The header says which algorithm was used and, if present, which key identifier (kid) should be used. The payload is a set of claims โ€” sub, iss, aud, exp, and whatever your application adds. The signature is a cryptographic seal over the first two segments.

Only the signature is security-relevant. The first two segments are not encrypted; they are simply encoded, which means anyone who holds the token can read every claim inside it. A decoder is therefore a reading tool, not an authentication tool.

02Decoding is not verifying

A decoder shows you what the issuer claims. Verification answers a different question: did the issuer actually sign this, with a key I trust, and is it still valid for me? Verification requires the public key or shared secret, checking the alg header against an allow-list, and validating iss, aud and exp.

If a system decides permissions by decoding a token's payload and trusting it, an attacker can craft any payload they like and the signature will be garbage โ€” but the system never checked it. This is the most common JWT vulnerability in the wild and it does not require any cryptography to exploit, just a base64 encoder.

Try the free JWT Decoder

03The claims worth checking first

When a token fails unexpectedly, nine out of ten times it is one of these. Check them in this order:

  • exp โ€” expiry. Tokens are usually short-lived; a clock skew of a minute or two is normal and expected.
  • nbf and iat โ€” not-before and issued-at. A token used before nbf is rejected, which shows up as a confusing 401 right after a deploy.
  • aud โ€” the audience. A token issued for api.example.com should not be accepted by app.example.com.
  • iss โ€” the issuer. Always compare against the exact issuer you configured, not a substring.
  • alg โ€” the algorithm. Reject none, and never let the token choose between symmetric and asymmetric verification.

04Never paste production tokens into a random website

A JWT is a bearer credential. Anyone who has the string can act as that user until it expires. Most online decoders are honest, but some log request bodies, and browser extensions can read what you paste long after you closed the tab.

ZeroKit's decoder runs entirely in your browser: the token is read by JavaScript on your machine and never sent to a server, which you can confirm in the network panel of DevTools. Even so, the safe habit is to use throwaway tokens from staging, or decode locally, and to rotate anything you may have pasted into an untrusted tool.

05A checklist before you trust a token

If you are building the verifying side: pin the algorithm, fetch keys from the issuer's JWKS endpoint rather than pasting a key, cache keys but handle rotation, compare iss and aud strictly, enforce exp and nbf with a small leeway, and reject tokens whose kid you do not recognise. Then decode a token from your own system and confirm every claim is one you expect. An unexpected custom claim is often a sign that a debug build reached production.

References

Written for ZeroKit. Every tool mentioned here runs locally in your browser โ€” nothing you paste is uploaded.

Related tools