Skip to content

JWT expiry checker

See when a token was issued, when it becomes valid and when it expires, on a timeline with a live countdown in your time zone.

Runs in your browser. Nothing you paste is sent to us.

Token

A sample token issued a minute ago, valid for 5 minutes, is filled in. Paste yours; it stays in your browser.

Timeline

How to use it

  1. Paste the token.
  2. Read the status: valid now, not valid yet, or expired.
  3. Use the timeline to see iat, nbf, exp and auth_time against the current time.
  4. Check the lifetime and the time left.

What to know

JWT times are Unix seconds in UTC. exp is when the token stops working, nbf when it starts, iat when it was issued, and auth_time when the user signed in.

Keycloak access tokens live for 5 minutes by default. The realm setting is Access Token Lifespan, under Realm settings, Tokens, and a client can override it.

If a fresh token shows as expired or not yet valid, the clocks of the issuer and the checker differ. Keep servers in sync with NTP.

Why token lifetimes matter

An access token works for anyone who holds it until it expires. Short lifetimes limit the damage of a leaked token; long lifetimes save round trips but widen that window. Most token problems in day-to-day work are timing problems: a token that expired a moment ago, one that is not valid yet on a server with a fast clock, or a lifetime nobody meant to set.

This tool reads the time claims in a token and lays them out on a timeline next to the current time, with a countdown that ticks every second.

The time claims in a JWT

ClaimNameWhat it means
iatIssued atWhen this token was created
nbfNot beforeThe token must not be accepted before this time
expExpirationThe token must not be accepted at or after this time
auth_timeAuthentication timeWhen the user last actively signed in (OpenID Connect)

All four are NumericDate values: seconds since 1970-01-01 in UTC, ignoring leap seconds (RFC 7519). They carry no time zone. The tool shows each one in UTC and in your local time zone, with the raw number next to it.

Reading two time claims
"iat": 1764000000   →  2025-11-24T16:00:00Z
"exp": 1764000300   →  2025-11-24T16:05:00Z   (5 minutes later)

What the checker shows

  • A status: valid now, not valid yet, expired, or no expiry at all.
  • A timeline with a mark for each time claim and one for now.
  • Each time in your local time, in UTC, as a relative time and as the raw number.
  • The lifetime from iat to exp, and the time left.

Everything is computed against your computer’s clock. If your clock is wrong, the status is wrong too, which is itself a useful hint when a server and a laptop disagree.

How to check a token

  1. Paste the token. The Bearer prefix is fine.
  2. Read the status line under the box.
  3. Look at the timeline: where “now” sits between the marks tells you the story at a glance.
  4. Read the lifetime and time left in the table.

Token lifetimes in Keycloak

Keycloak sets token lifetimes in the realm and lets clients override some of them.

SettingWhereAffects
Access Token LifespanRealm settings, Tokens; per client in Advancedexp of access tokens (5 minutes by default)
SSO Session IdleRealm settings, SessionsHow long a session lives without activity; caps refresh tokens
SSO Session MaxRealm settings, SessionsThe longest a session can live, however active
Offline Session IdleRealm settings, SessionsHow long offline tokens stay usable without use

A refresh token’s exp follows the session settings rather than the access token lifespan. That is why a refresh token usually lives much longer than the access tokens it produces.

iat and auth_time after a refresh

When an app refreshes, Keycloak issues a new access token with a new iat and exp. The auth_time claim stays the time the user actually signed in. Comparing the two tells you how long ago the user last entered credentials, which matters for sensitive actions.

Use cases

“Token expired” errors that seem too early

Paste the token that failed. If its lifetime is 5 minutes and your app cached it for longer, the fix is to refresh before exp, not to raise the lifespan.

“Token not yet valid” errors

If a fresh token shows as not valid yet, the issuer’s clock is ahead of the checker’s. Sync both with NTP, and allow a small clock skew in your validation.

Checking a configuration change

After changing a lifespan in the admin console, get a new token and confirm the lifetime here. Tokens issued before the change keep their old expiry.

Planning refresh timing

Apps should refresh a little before exp, not at the moment it passes. Seeing the real lifetime helps you choose how early.

Common mistakes

  • Treating JWT times as milliseconds. A 13-digit value is milliseconds and will be read as a date far in the future.
  • Comparing times in local time. NumericDate is UTC; convert only for display.
  • Raising the access token lifespan to work around refresh bugs. Fix the refresh logic instead.
  • Expecting a revoked token to show as expired. Revocation does not change exp; only introspection or the session state reveals it.

Refreshing before expiry

A client that waits for a 401 before refreshing makes users see errors. A client that refreshes on a timer, slightly before exp, never does. The usual approach is to read exp from the access token response, or from the expires_in value next to it, and schedule the refresh a little earlier.

Scheduling a refresh 30 seconds before expiry
// expires_in comes with every token response, in seconds
const refreshAt = Date.now() + (tokenResponse.expires_in - 30) * 1000;
setTimeout(refresh, refreshAt - Date.now());

The token response from Keycloak’s token endpoint includes expires_in for the access token and refresh_expires_in for the refresh token. They are relative seconds, so they do not depend on the client’s clock.

Clock skew, explained

Two machines rarely agree on the time to the second. If the issuer’s clock runs ahead of the API’s, a fresh token looks issued in the future; if it runs behind, tokens seem to expire early. Validators allow a small skew to absorb the difference.

SituationWhat you seeWhat to do
Issuer clock aheadiat or nbf in the futureSync clocks; allow 30 to 60 seconds of skew
Issuer clock behindTokens expire earlier than expectedSync clocks
Your laptop clock wrongThis page shows odd relative timesFix your computer’s time setting

The expiry checker uses your computer’s clock with no skew, so it shows exactly where the token stands. The claims validator applies a configurable skew the way an API would.

Reading the timeline

The bar runs from the earliest time claim to the latest, with “now” placed among them. The blue part is the window in which the token is valid: from nbf, or iat if there is no nbf, to exp.

  • “now” inside the blue window: the token is valid by time.
  • “now” to the right of exp: the token has expired.
  • “now” to the left of nbf: the token is not valid yet.
  • auth_time far to the left: the user signed in long ago and the app has been refreshing since.

Security notes

A token that has not expired is not necessarily valid: its signature, issuer and audience still need checking, and its session may have ended. Use the signature verifier and the claims validator for the rest.

The sample token on this page is unsigned and made up. Its times are set when the page opens so the timeline has something live to show.

Tokens without exp never expire on their own. The security checker flags them.

Best practices

  • Keep access tokens short-lived, minutes rather than hours.
  • Refresh before expiry and handle a failed refresh by signing the user in again.
  • Allow 30 to 60 seconds of clock skew in validation, and keep server clocks synced.
  • Use auth_time when an action needs a recent sign-in.
Questions

Frequently asked questions

Why do my tokens expire so fast?

Short-lived access tokens limit the damage if one leaks. Keycloak issues access tokens for 5 minutes by default, and apps get new ones with a refresh token instead of using long-lived access tokens.

What is the difference between `iat` and `auth_time`?

`iat` is when this token was issued. `auth_time` is when the user last signed in. After a refresh, `iat` changes and `auth_time` stays the same.

Are JWT times in seconds or milliseconds?

Seconds since 1970 in UTC, called NumericDate in RFC 7519. A 13-digit number is milliseconds and is not a valid JWT time.

How do I change the access token lifetime in Keycloak?

Set Access Token Lifespan under Realm settings, Tokens for the whole realm, or in a client’s advanced settings for one client. New tokens use the new value; existing tokens keep theirs.

How long does a Keycloak refresh token last?

Its expiry follows the session settings, mainly SSO Session Idle and SSO Session Max, rather than the access token lifespan. Offline tokens follow the offline session settings.

Why does a fresh token show as not valid yet?

The issuer’s clock is ahead of yours. Sync both machines with NTP and allow a small clock skew when validating.

Can a token be invalid before it expires?

Yes. It can be revoked, its session can end, or its signature or audience can be wrong. Expiry is only one of the checks.

What is `expires_in` in the token response?

It is the access token’s lifetime in seconds, counted from when the response was issued. Clients can use it to schedule a refresh without reading the token or trusting their own clock.

Does the countdown update by itself?

Yes. The status, time left and timeline update every second while the page is open.

What if the token has no `exp`?

The status says “No expiry”. RFC 7519 makes `exp` optional, but a token without it stays usable until something else stops it, which is a security risk for access tokens.

Rather not run Keycloak yourself?

We run it for you on a cluster of your own, with backups, upgrades and written support. Starter and Premium begin with a 7-day trial.