Anatomy of a JSON Web Token (RFC 7519)
A JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained method for securely transmitting information between parties as a JSON object. Tokens are commonly utilized in OAuth 2.0, OpenID Connect (OIDC), and stateless REST APIs.
A valid JWT string is composed of three distinct base64url-encoded segments joined by periods (.):
Defines the token type (usually "JWT") and the hashing algorithm used, such as HMAC SHA256 (HS256) or RSA Signature (RS256).
Contains the claims: entity statements (such as user ID, email, role, and permission scopes) along with expiration timestamps.
Computed by hashing the encoded header and payload with a private server key to verify the message hasn't been tampered with.
Standard Registered Claims Reference
Critical Security Rules for JWT Implementation
Base64URL encoding is easily readable by anyone possessing the string. Never store sensitive information such as plaintext passwords, credit card details, or social security numbers in standard JWT payloads. If confidentiality is required, implement JSON Web Encryption (JWE).
Always configure server verification libraries to explicitly require expected algorithms (e.g. RS256 or HS256) and reject tokens specifying "alg": "none".
Storing session JWTs in browser localStorage exposes tokens to Cross-Site Scripting (XSS) attacks. Storing tokens in HttpOnly, SameSite=Strict cookies prevents JavaScript injection vulnerabilities.
Frequently Asked Questions (FAQ)
How does this tool check if my token is expired?
The tool reads the exp claim (which represents seconds since the Unix epoch: January 1, 1970) and compares it with your computer's current local system clock to determine if the token is active or expired.
Why does the decoder warn about invalid token structure?
A compliant JWT must contain exactly two period characters separating three sections. If you paste an OAuth authorization code or an API Bearer prefix without stripping "Bearer ", the parser will report an invalid token format.