๐Ÿ“š Developer ยท Guide

How to Decode a JWT and Check Its Expiry (JSON Web Token Guide)

Decode a JSON Web Token's header and payload, read its claims and check when it expires, safely in your browser. Learn how JWTs work and the security mistakes to avoid.

By RexBD Team 24 Nov 2026 8 min read 1,598 words
How to Decode a JWT and Check Its Expiry (JSON Web Token Guide)

If you build or debug web applications, you meet JSON Web Tokens constantly. They sit in Authorization headers, cookies and local storage, and they decide whether a user is logged in, which account they belong to and what they are allowed to do. When something goes wrong, such as a user suddenly being logged out or an API returning 401 Unauthorized, the first step is usually to look inside the token.

A JWT decoder shows you what a token contains in a readable form. This guide explains how to use the free JWT Decoder on RexBD, how JWTs are structured, what the common claims mean and the security points every developer should know.

What a JWT looks like

A JWT is a long string made of three parts separated by dots:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjMiLCJuYW1lIjoiUmFoaW0iLCJleHAiOjE4MDAwMDAwMDB9.signature

  1. Header: describes the token, mainly which signing algorithm was used.
  2. Payload: contains the claims, the actual data such as the user ID, name, roles and expiry time.
  3. Signature: proves the token was issued by someone holding the secret or private key and has not been changed.

The header and payload are JSON objects encoded with Base64URL, a URL-safe version of Base64. That encoding is easily reversible. It is designed to make the token safe to send in URLs and headers, not to hide its contents.

๐ŸŽŸ๏ธ Free tool ยท no sign-upTry the JWT DecoderDecode a JSON Web Token's header and payload and check its expiry time. Open tool โ†’

How to use the JWT Decoder

Step 1: Copy the token

Get the token from where your application stores it: the Authorization header in your browser's network tab (after the word "Bearer"), a cookie, local storage or your server logs.

Step 2: Paste it into the decoder

Open the JWT Decoder and paste the full token, including all three parts.

Step 3: Read the header and payload

The tool decodes both parts and shows them as formatted JSON.

Step 4: Check the expiry

The decoder reads the exp claim and shows when the token expires in a readable date and time, and whether it has already expired. This is often the answer to "why was I logged out?".

The decoding happens entirely in your browser. That matters, because a JWT is a credential. Pasting a live token into a website that sends it to a server could let someone else use it while it is still valid.

The standard claims explained

The JWT standard (RFC 7519) defines a set of registered claim names. Most tokens use some of them:

Claim Name Meaning
iss Issuer Who created the token, such as your auth server
sub Subject Who the token is about, usually the user ID
aud Audience Who the token is intended for, such as your API
exp Expiration time When the token stops being valid
nbf Not before When the token starts being valid
iat Issued at When the token was created
jti JWT ID A unique identifier for this token

Applications add their own claims too, such as name, email, role or permissions.

Understanding the timestamps

exp, nbf and iat are Unix timestamps: the number of seconds since 1 January 1970 (UTC). For example, 1800000000 is a moment in January 2027. The decoder converts these for you. To convert other timestamps, use the Timestamp Converter.

Some systems mistakenly use milliseconds instead of seconds, producing timestamps thousands of years in the future. If an expiry date looks absurd, that is a likely cause.

Ad Kothay

A worked example: a user keeps getting logged out

A support ticket says: "The app logs me out every few minutes." You open the browser's developer tools, copy the access token from a failing request and paste it into the decoder.

The payload shows iat (issued at) at 10:00 and exp at 10:05. The token lives only five minutes. That alone is not a bug; many systems use short-lived access tokens on purpose. The real question is why the app does not refresh it. You check the network tab and see the refresh request failing with an error. The problem is in the refresh flow, not the login itself.

In a second case, the decoded token shows exp correctly set to an hour later, but the server rejects it immediately. You compare the token's iat with the current time and notice it is several minutes in the future. The server's clock is wrong. Fixing the clock synchronisation (NTP) on the server solves the problem. Clock skew between servers is a surprisingly common cause of JWT failures.

Decoding is not verifying

This point causes real security bugs. Anyone can decode a JWT, including attackers. Decoding only shows what the token says. It does not prove the token is genuine.

Verification checks the signature with the correct secret or public key. Only after verification can a server trust the claims. Your backend must always:

  1. Verify the signature with a trusted library.
  2. Check that the algorithm is the one you expect, and never accept alg: none.
  3. Check exp, nbf, iss and aud.
  4. Reject tokens that fail any check.

Never make security decisions in frontend code based on a decoded token, such as hiding an admin page, without also enforcing those permissions on the server.

Security mistakes to avoid

Putting secrets in the payload

The payload is readable by anyone who has the token. Never include passwords, API keys, full card numbers or sensitive personal data. Include only what the receiving service needs, such as an ID and roles.

Accepting the "none" algorithm

Early JWT libraries had a famous vulnerability where an attacker could change the algorithm to none and remove the signature. Modern libraries protect against this, but always configure the expected algorithm explicitly.

Weak signing secrets

For HMAC algorithms such as HS256, the secret must be long and random. A short, guessable secret can be brute-forced, allowing attackers to forge tokens. Generate a strong one with the Random String Generator.

Very long expiry times

A token that lasts a month is a month-long risk if it is stolen. Use short-lived access tokens with a refresh mechanism.

Storing tokens carelessly

Tokens in local storage can be read by any script running on the page, so cross-site scripting (XSS) vulnerabilities can leak them. Many teams prefer secure, HttpOnly cookies. Each approach has trade-offs; the key is to understand them and protect against XSS.

Pasting live production tokens into online tools

Only use tools that decode locally, like this one, and prefer test tokens or expired tokens when sharing examples with colleagues.

A debugging checklist for JWT problems

When a request fails with 401 or 403 and you suspect the token, work through this list. It covers the vast majority of real-world cases:

  1. Is a token being sent at all? Check the request headers in the browser's network tab. A missing "Authorization: Bearer" header is a client bug.
  2. Is it the right token? Applications often have both an ID token and an access token. APIs usually expect the access token.
  3. Has it expired? Decode it and check exp against the current time.
  4. Is the audience right? If aud names a different API, the server should reject it.
  5. Is the issuer right? Tokens from a test login server will fail on production, and the other way round.
  6. Does it include the required roles or scopes? A 403 Forbidden often means the token is valid but lacks a permission.
  7. Are the clocks in sync? Compare iat with the real time.
  8. Was the signing key rotated? If the auth server changed its keys, old tokens and cached keys can fail verification.

Decoding the token answers questions 2 to 7 in seconds, which is why a decoder is one of the most useful tools for API debugging.

Creating test tokens

When building or testing an API, you often need tokens with specific claims, for example an expired token or a token with a particular role. The JWT Generator creates signed test tokens in your browser. Combine it with the decoder to check what you created.

JWT versus session cookies

JWTs are popular, but they are not always the best choice:

JWT Server session
Where data lives In the token On the server
Revoking a login Hard before expiry Easy, delete the session
Scaling across servers Easy, no shared storage Needs shared session storage
Token size Larger, sent with every request Small session ID

Many applications combine them: short-lived JWTs for APIs plus a server-side refresh token that can be revoked.

Our JWT tips and mistakes article goes deeper into token design.

Frequently asked questions

Is it safe to paste my JWT into this decoder?

The RexBD decoder works entirely in your browser and does not send the token anywhere. Still, treat live tokens as passwords and avoid sharing them.

Can the decoder verify the signature?

Decoding shows the contents. Signature verification must be done by your server with the correct key.

Why can anyone read my JWT payload?

Because it is only Base64URL-encoded, not encrypted. Do not put secrets in it. If you need encrypted tokens, look at JWE (JSON Web Encryption).

What does "exp" mean?

It is the expiry time as a Unix timestamp in seconds. After that moment, servers should reject the token.

Why is my token rejected even though it has not expired?

Common causes are a wrong signature key, the wrong audience or issuer, a token used before its nbf time, or clock differences between servers.

Is the JWT Decoder free?

Yes. It is free and requires no sign-up.

Found this useful?Share it with a friend or colleague who needs it.

Keep reading

More developer articles
321 free tools, one placeSEO, text, images, code, money, units and design. Private, fast and almost all in your browser.
Ad Kothay