Skip to content
🛠️ToolsShed

JWT Expiry Checker

Decode and inspect JWT tokens — check expiration and all time claims.

About this tool

A JWT (JSON Web Token) is a compact, digitally signed token widely used for authentication and authorization in modern applications. The JWT Expiry Checker helps you quickly inspect whether a token has expired and view all the claims it contains—such as user ID, roles, and issued/expiration timestamps—without needing backend tools or command-line utilities. This is invaluable for debugging authentication issues, validating token contents during development, or understanding what data your application is processing.

To use the checker, simply paste your JWT token into the input field and the tool decodes it instantly, displaying the header, payload, and signature verification status. You can immediately see when the token expires, whether it's still valid, and what claims are embedded within it. This is especially useful when working with third-party APIs, testing login flows, or troubleshooting why certain API requests are being rejected due to token expiration.

Frequently Asked Questions

Code Implementation

import base64
import json
import time

def decode_jwt_payload(token: str) -> dict:
    """Decode JWT payload without verifying signature."""
    parts = token.split(".")
    if len(parts) != 3:
        raise ValueError("Not a valid JWT (expected 3 parts)")
    # Base64url decode: add padding and replace URL-safe chars
    payload_b64 = parts[1].replace("-", "+").replace("_", "/")
    payload_b64 += "=" * (-len(payload_b64) % 4)
    return json.loads(base64.b64decode(payload_b64))

def check_jwt_expiry(token: str):
    payload = decode_jwt_payload(token)
    now = int(time.time())

    exp = payload.get("exp")
    if exp is None:
        print("No exp claim — token does not expire")
        return

    remaining = exp - now
    if remaining <= 0:
        print(f"EXPIRED {abs(remaining)} seconds ago")
    else:
        print(f"Valid for {remaining} seconds ({remaining // 60} minutes)")

    if "iat" in payload:
        print(f"Issued at: {time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(payload['iat']))}")
    if "nbf" in payload:
        print(f"Not before: {time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(payload['nbf']))}")

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.