Skip to the content

Contact usFree tools · No signup · Files stay on your device

Developer Tools

"JWT expired" errors: reading exp, iat and nbf correctly

"JWT expired" errors: reading exp, iat and nbf correctly

"JWT expired" is the message your API gives when a token's lifetime has run out. It is one of the most common login problems, and often the token is not the real culprit: the clocks, the units or the way the expiry was written are. The quickest way to find out is to paste the token into the free JWT Decoder, which turns exp, iat and nbf into plain dates and says in one line whether the token is expired, not yet valid or still good.

This article explains what those three claims mean, how to read them correctly, and the five usual reasons a token looks expired when it should not be. For a tour of the whole decoder, see the complete JWT Decoder guide.

What exp, iat and nbf mean

All three are times, written as whole seconds since 1 January 1970 at 00:00 UTC. The standard calls this format NumericDate.

Claim Meaning The server's rule
iat Issued at: when the token was created Informational. Most servers do not reject on it.
nbf Not before: the earliest moment the token is valid Reject if the current time is earlier than this.
exp Expiration: the moment the token stops being valid Reject if the current time is at or after this.

The lifetime of a token is exp minus iat. If iat is 1795770000 and exp is 1795773600, the difference is 3,600 seconds, so the token lives one hour.

Because the numbers are plain seconds, they carry no time zone. A person in Dhaka and a server in London read exactly the same number. A time zone only appears when someone displays it, and that is where confusion starts.

Step 1: read the token with JWT Decoder

  1. Copy the token from your request, log or browser storage. A leading Bearer is fine.
  2. Open JWT Decoder and paste it into the box labelled "JWT (header.payload.signature)".
  3. Find the Claims panel. Its first line is the verdict.

You will see one of these messages:

  • "Expired 10 minutes ago." The time has passed.
  • "Valid — expires in 50 minutes." The token is fine right now.
  • "Not valid yet — becomes valid in 2 minutes." Something is wrong with nbf.
  • "No expiry (“exp”) — this token never expires unless the server checks something else."
  • "“exp” looks like milliseconds — JWT times must be in seconds…" The claim was written in the wrong unit.
  • "“exp” must be a number of seconds since 1970 (NumericDate)." The value is text or another type.

Below the verdict, each time claim is shown in your local time, in relative words, and as an exact UTC time with the raw seconds. For a token issued at 09:00 UTC with exp at 10:00 UTC, someone in Bangladesh sees 3:00 PM and 4:00 PM (GMT+6), and the UTC line underneath confirms 10:00:00. Always compare the UTC line when you talk to a colleague in another country.

The tool's verdict uses exp and nbf only. It reads iat for display, but never rejects a token because of it. It also applies no grace period: the moment the clock reaches exp, the message changes to Expired.

The five usual reasons

1. The token really expired

The verdict says Expired and the "ago" time is sensible. That is the normal case: access tokens are meant to be short, often minutes or an hour. The fix is a flow, not a tweak: the client should use its refresh token, or send the user back to log in, when it receives a 401. Do not try to edit exp. Any change breaks the signature.

2. Milliseconds written instead of seconds

JavaScript's Date.now() returns milliseconds, for example 1795773600000. A JWT needs 1795773600. If your own code builds exp as Date.now() + 3600000, the value is 13 digits long and the decoder warns that it looks like milliseconds. Most libraries then see an expiry thousands of years away, so you get tokens that never expire, which is a security problem rather than a login problem. A 10-digit value is seconds and a 13-digit value is milliseconds. Correct it where the token is created.

The reverse mistake happens too: code that compares exp with Date.now() directly sees a seconds value as being in 1970 and reports every token as expired. If everything is "expired" for everyone, check this first.

3. Clock drift between machines

The issuer and the checker may be different servers, or a phone and a server. If one clock is a few minutes off, a perfectly good token fails. A token with nbf slightly ahead of the checker's time shows the "Not valid yet" verdict in the decoder, and the matching library error is often phrased like "jwt not active". A short-lived token checked on a server whose clock is fast can read "jwt expired" a minute after it was issued.

Check the date and time settings on the machines involved. For servers, make sure time sync (NTP) is running. Libraries also let you allow a small tolerance, called leeway or clock tolerance, of a few seconds to a minute, which absorbs small drifts without weakening the token much.

4. A time zone slip when creating exp

If code builds a date string such as "2026-11-27 16:00" and parses it without a zone, the result depends on the machine's time zone. In Dhaka that is UTC+6, so the token may land six hours too early or too late. Always create exp from a real epoch value: the current time in seconds plus the lifetime in seconds.

5. The wrong token is being sent

Sometimes the token in the request is an old one: cached in storage, left in a header by a client, or from a different environment. Decode the one that actually arrives at the server, taken from the request log, not the one you remember getting. Compare its iat with the time you logged in.

A quick diagnosis table

What the decoder shows Likely cause
Expired a few minutes ago, normal lifetime Ordinary expiry: refresh or log in again
Expired, but iat was seconds ago Clock drift, or a lifetime written in the wrong unit
"Not valid yet" for a minute or two The issuer's clock is ahead of the checker's
"exp looks like milliseconds" Date.now() used without dividing by 1000
"No expiry" The token was issued without exp: add one
"exp must be a number" The claim was written as a string such as "1795773600"

What the error looks like in common libraries

Different libraries word it differently. In Node.js, the jsonwebtoken package raises TokenExpiredError: jwt expired for a past exp and NotBeforeError: jwt not active for a future nbf. In Python, PyJWT raises ExpiredSignatureError: Signature has expired. The message names the claim that failed, so use it to decide whether to look at exp or nbf in the decoder.

What to do next

  1. Decode the exact token that failed and note the verdict.
  2. Compare UTC times, not local ones, with the server's logs.
  3. Check the unit: 10 digits is seconds, 13 digits is milliseconds.
  4. Check the clocks and add a small leeway if the drift is real.
  5. Make sure the client refreshes its token when it gets a 401.

If you need to convert another number from a log into a date, the Timestamp Converter handles seconds and milliseconds. And to read the whole payload in a tidy layout, copy it into the JSON Formatter.

Quick checklist

  • exp, iat and nbf are seconds since 1970, in UTC.
  • A token is valid from nbf until exp.
  • Never edit a token's exp; ask for a new token.
  • A 13-digit time is milliseconds and is wrong in a JWT.
  • Compare the UTC times when you debug with other people.

Frequently asked questions

What does jwt expired mean?
The server compared the token's exp claim with its own clock and found that the current time is at or past it. The token itself is not broken; it simply ran out of time and needs to be replaced by a fresh one.
Are exp, iat and nbf in milliseconds?
No. They are NumericDate values: whole seconds since 1 January 1970 UTC. JavaScript's Date.now() gives milliseconds, so divide by 1000 when creating them. A 13-digit value is milliseconds and a 10-digit value is seconds.
Why does a brand-new token say it is expired or not active?
Usually the machine that issued it and the machine that checks it disagree about the time. If the issuer's clock is ahead, the new token's nbf or iat looks like the future; if the checker's clock is ahead, exp has already passed.
Does the time zone matter for a JWT?
Not inside the token. exp, iat and nbf are time-zone-free seconds. The time zone only matters when you display them, which is why a decoder shows both your local time and UTC.
Can I extend an expired token?
No. Changing exp would break the signature, and a server would reject it. The client has to request a new token, normally with a refresh token or by logging in again.
Found this useful? Share it

Tools in this guide

Main tool

JWT Decoder

Paste a JSON Web Token to read its header and claims, see whether it's expired, and optionally verify the signature with a secret or public key.

Open tool

Timestamp Converter

See the current Unix time, turn any epoch timestamp into a human-readable date in any time zone, or convert a date back to seconds and milliseconds.

Open tool

JSON Formatter

Paste messy or minified JSON to get clean, indented output instantly — or minify it for production.

Open tool

Back to all guides & blog