Anatomy of a JWT
A JSON Web Token consists of three Base64URL-encoded segments separated by dots: header.payload.signature. Understanding each part is essential for debugging auth issues and building secure systems.
The header is a JSON object specifying the token type ("typ": "JWT") and the signing algorithm ("alg": "HS256"). The payload contains claims — statements about the user and metadata. The JWT specification (RFC 7519) defines several registered claims:
iss(issuer) — who created the tokensub(subject) — the user or entity the token representsaud(audience) — the intended recipient serviceexp(expiration) — Unix timestamp after which the token is invalidiat(issued at) — Unix timestamp of token creation. Convert these with our Timestamp Converter.jti(JWT ID) — a unique identifier to prevent replay attacks, often a UUID
The signature is computed over the encoded header and payload using the specified algorithm and a secret key. It guarantees integrity — if anyone modifies the header or payload, the signature verification will fail. Crucially, the payload is only encoded, not encrypted. Decode any JWT with our Base64 decoder to see the raw claims.