Skip to content
Calcrivo

JWT Expiry Calculator

Pick a JWT exp claim: validity window with clock skew, when to refresh early, and how long a revoked token stays accepted.

Inputs

minutes
seconds
%
minutes
req/min

Refresh the Token At

12m

Worst-Case Validity Window

16m

Refreshes per Session

39

Requests Served per Token

75

Maximum Stale Access After Revocation

960seconds

Assessment

Balanced lifetime for a bearer token

Step by step

  1. Values used

    Token lifetime (exp − iat) = 15 minutes; Clock skew leeway allowed by verifiers = 60 seconds; Refresh this far before expiry = 20 %; Session length to cover = 480 minutes; Requests per minute per client = 5 req/min

  2. JWT Expiry

    validity = (exp − iat) + clock skew leeway; refresh at (exp − iat) × (1 − refresh margin) so a renewal is in flight before the token dies.

  3. Revocation exposure

    stale access after revocation = validity window, since a verifier that only checks the signature cannot learn the token was withdrawn.

  4. Refresh the Token At

    = 12

  5. Worst-Case Validity Window

    = 16

  6. Refreshes per Session

    = 39

  7. Requests Served per Token

    = 75

  8. Maximum Stale Access After Revocation

    = 960 seconds

  9. Assessment

    = Balanced lifetime for a bearer token

How it works

Verifiers usually accept a token for a little past its exp to tolerate clock drift, so the real validity window is the lifetime plus that leeway on each end. Refreshing at a fraction of the lifetime keeps a valid token in hand at all times instead of racing the expiry. The exp claim is the only revocation mechanism a stateless JWT has, so its value is literally the length of time a compromised or logged-out session keeps working.

Formulas

JWT Expiry

validity = (exp − iat) + clock skew leeway; refresh at (exp − iat) × (1 − refresh margin) so a renewal is in flight before the token dies.

exp
Expiry claim, seconds since the Unix epoch
iat
Issued-at claim
clock skew leeway
Extra tolerance verifiers allow for unsynchronised clocks

Revocation exposure

stale access after revocation = validity window, since a verifier that only checks the signature cannot learn the token was withdrawn.

nbf
Not-before claim — the same skew leeway applies at the start of the window

Frequently Asked Questions

How is JWT Expiry calculated?

validity = (exp − iat) + clock skew leeway; refresh at (exp − iat) × (1 − refresh margin) so a renewal is in flight before the token dies. Verifiers usually accept a token for a little past its exp to tolerate clock drift, so the real validity window is the lifetime plus that leeway on each end. Refreshing at a fraction of the lifetime keeps a valid token in hand at all times instead of racing the expiry.

Why does JWT Expiry matter?

The exp claim is the only revocation mechanism a stateless JWT has, so its value is literally the length of time a compromised or logged-out session keeps working.

What values do I need to enter?

This calculator takes 5 inputs: Token lifetime (exp − iat), Clock skew leeway allowed by verifiers, Refresh this far before expiry, Session length to cover, Requests per minute per client. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.

How much clock skew leeway should a verifier allow?

Thirty to sixty seconds is typical and most libraries default to that range. Larger values silently extend every token's life, so if servers are NTP-synchronised there is little reason to go beyond a minute — and none to disable expiry checking to work around a drifting clock.

Can I revoke a JWT before it expires?

Not in the token itself. You need server-side state: a deny-list of jti values checked on each request, a token-version claim compared against the user record, or an introspection call. All three trade the statelessness that made JWTs attractive, which is why short lifetimes remain the usual answer.

You might also need