A JWT consists of three Base64-encoded parts separated by dots: header.payload.signature. The header specifies the signing algorithm. The payload contains claims — arbitrary data (user_id, roles, exp). The signature lets the server verify the token has not been tampered with.
JWTs cannot be revoked before expiry without a blacklist. Store them in an httpOnly cookie, not localStorage — this protects against XSS. Set a short exp (15–60 min) and use refresh tokens.