JWTs are everywhere. Login sessions, API auth, SSO flows — they all pass tokens around. Yet most developers paste them into random online tools without thinking twice. This guide shows you what a JWT actually contains and how to decode it safely.
What Is a JWT?
A JSON Web Token is a compact, URL-safe string that carries verified information between two parties. It has three parts separated by dots:
- Header — token type and signing algorithm
- Payload — claims about the user or session
- Signature — verifies the token was not tampered with
JWT structure example:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
eyJ1c2VyIjoiYWxpY2UiLCJyb2xlIjoiYWRtaW4iLCJleHAiOjE3MjAwMTIzNDV9.
SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
Step 1: Decode the Header
The header tells you how the token is signed. Look for the alg field. HS256 uses a shared secret. RS256 uses a private/public key pair. The typ field is almost always JWT.
Step 2: Inspect the Payload
The payload contains the actual data. Standard claims include:
- sub — subject, usually the user ID
- exp — expiration timestamp in Unix seconds
- iat — issued-at timestamp
- role or scope — custom authorization data
Privacy note: Never put sensitive data like passwords or credit card numbers in a JWT payload. The payload is only base64url encoded — it is not encrypted. Anyone with the token can read it.
Step 3: Check Expiry and Claims
The most common JWT issue is an expired token. Convert the exp Unix timestamp to a readable date. If it is in the past, the token is invalid regardless of the signature. Also verify the aud (audience) and iss (issuer) claims match your expectations.
Step 4: Use the JWT Decoder
Stop converting timestamps manually. The JWT Decoder parses the header and payload instantly, highlights expiry, and shows every claim in a readable table. It runs entirely in your browser — your token never leaves your device.
Debugging Common Auth Flows
JWTs fail silently when you least expect it. Here are the most common issues:
- Token expired: Check
expvs current time. Refresh if you have a refresh token. - Wrong algorithm: The server expects RS256 but the client sends HS256. Check the
algheader. - Missing claims: Your API expects a
roleclaim but the auth server did not include it. - Clock skew: Server and client clocks are out of sync. Add a small leeway when validating
exp.
Browse all dev tools: AllOmnitools.com/all-tools/ – 20+ free developer utilities, no account required.