JWT Decoder
Decode a JWT and read its claims safely.
- Local by default
- No signup
- AI is opt-in
Decoding is not verification. This page only reads the token contents. It does not check the signature, so a valid-looking payload proves nothing about who issued it. Verify signatures on your server.
A JSON Web Token is three Base64URL segments joined by dots. Decoding it shows the header and claims, which is useful for debugging expiry, audience and issuer problems — as long as you remember that decoding proves nothing about authenticity.
The three segments
A JWT looks like header.payload.signature. The header is JSON describing the algorithm and token type. The payload is JSON containing claims — who the user is, who issued the token, when it expires. The signature is a cryptographic tag over the first two segments, produced with a key you may not have.
Header and payload are Base64URL encoded, not encrypted. Anyone holding the token can read every claim. This is by design: JWTs carry assertions, not secrets. Never put a password, full card number or private key inside a payload.
What the registered claims mean
iss— issuer. Your server should check this against an allowlist, not just read it.sub— subject, usually the user id. Must be unique and stable per user.aud— audience, the service the token is meant for. A token issued for your API should not be accepted by another service.exp— expiry as a Unix timestamp in seconds. Required for anything short-lived.nbf— not valid before. Rarely used, and clock skew makes it fragile.iat— issued at. Useful for auditing, not for security decisions.jti— token id, used for revocation lists.
Decoding is not verification
Verification recomputes the signature with the issuer’s key and compares it, then checks the claims. Decoding does neither. A payload that says "role": "admin" can be produced by anyone with a text editor, and no amount of reading it will tell you whether it was signed by your identity provider.
- alg: none. Some libraries historically accepted unsigned tokens when the header said
"alg": "none". Reject that value explicitly. - Algorithm confusion. If the verifier accepts whatever the header declares, an attacker can switch RS256 to HS256 and sign with the public key as the HMAC secret.
- No expiry check. A validly signed token is still invalid after
exp. Verification must check time, not just the signature.
This page never verifies signatures. It has no key and makes no network requests, so it cannot tell a genuine token from a forged one.
A five-minute debugging routine
- Split the token on dots. It must have exactly three non-empty parts; a two-part value is not a JWT.
- Decode the header and confirm the algorithm matches what your verifier expects. A token that suddenly says HS256 when you issue RS256 is a red flag.
- Compare
expwith the current time in seconds:Math.floor(Date.now() / 1000). A token can be perfectly signed and still expired. - Check
issandaudagainst the values your service requires. A token for another audience must be rejected even when the signature is valid. - Only then investigate the signature: key rotation, a wrong environment, or a missing
Bearerprefix are far more common than a broken crypto library.
const payload = JSON.parse(atob(token.split(".")[1]));
Date.now() / 1000 > payload.exp // true means expiredThe snippet above is for debugging, not verification. atob does not handle Base64URL safely, so production code should use a maintained JWT library.
Expiry and clock skew
Tokens are usually short-lived — five to sixty minutes — with a refresh token handling renewal. If you see mass 401s immediately after deployment, check the server clock before the signing code: a container drifting a few minutes behind is enough to make freshly issued tokens look expired. A small tolerance (30–60 seconds) is normal practice.
Where to store a token
Storing a JWT in localStorage makes it readable by any script on the page, so one XSS bug becomes full account takeover. An HttpOnly, Secure, SameSite cookie is not readable by JavaScript and is the safer default for browser clients. Neither option protects you from XSS itself — the difference is how much an attacker gains.
Revocation, logout and token size
A signed JWT stays valid until it expires, whether or not the user logged out. Clearing local storage removes the client copy but tells the server nothing. That is why access tokens are short-lived and paired with a refresh token that can be rotated and revoked; if immediate invalidation is required, keep a jti denylist with a TTL equal to the token lifetime, or a token version on the user record.
Size is an operational concern rather than a security one. Tokens travel in an Authorization header or a cookie, and proxies often cap headers at 8 KB. Roles, permissions and profile fields added to claims can push a token past that limit and produce intermittent 431 responses that look like an auth bug. If a token grows beyond about a kilobyte, an opaque session identifier is usually the better design.
Frequently asked questions
Is it safe to paste a real token here?
The token never leaves your browser — decoding is local and there are no network requests. Still, a live token is a credential: treat pasting one into any page, including this one, as a small risk and prefer a test token when possible.
Can this tool verify the signature?
No. Verification needs the issuer’s key and must check claims such as exp and aud. Do that on your server with a maintained library, never in a browser tool.
Why Base64URL instead of normal Base64?
JWTs travel in URLs, headers and cookies, where +, / and = need escaping. Base64URL uses - and _ and drops padding so the token is safe to embed without further encoding.
My token looks valid but the API returns 401. Why?
Common causes: the token expired (check the exp claim against your server clock), the audience does not match, the issuer is not allowlisted, the signing key rotated, or the server expects a Bearer prefix in the Authorization header.
Does logging out invalidate a JWT?
Not by itself. A signed token remains valid until exp unless the server keeps a revocation list or a token version. Delete the client copy, expire access tokens quickly, rotate refresh tokens, and add a jti denylist if immediate revocation is required.
Why is my JWT so large?
Every claim is stored in the token and Base64URL-encoded, so roles, permissions and profile fields grow it quickly. Headers and cookies are often capped around 8 KB. If size becomes a problem, keep only identifiers in the token and load the rest from your API.