Security & Authentication•9 min read•October 12, 2026

What Is a JWT Token? A Beginner-Friendly Guide

If you have worked with modern web development, Single Page Applications (SPAs), or REST APIs, you have almost certainly encountered long strings separated by two dots. That string is a JSON Web Token (JWT). Here is everything you need to know about how they work, how to read them, and how to avoid critical security traps.

Inspect Any Token Safely

Try the Free JWT Decoder & Debugger

Paste any JWT to unpack its header, payload claims, and expiration timestamps in your browser with 100% client-side privacy.

Decode a Token Now →

What Exactly Is a JSON Web Token?

Defined formally under RFC 7519, a JSON Web Token is a compact, URL-safe means of transferring claims between two parties. Unlike traditional session-cookie authentication where the server stores user session data in a database or Redis cache, JWTs are stateless: the token itself contains all the identity information (claims) the server needs.

When a user logs in, the authorization server signs a JWT and delivers it to the client. On subsequent requests, the client passes this token (typically in the HTTP Authorization: Bearer <token> header). The server validates the cryptographic signature without querying a session database, making JWTs popular for distributed microservices and mobile applications.

The Three Parts of a JWT: Header, Payload & Signature

In its compact form, a signed JWT consists of three strings separated by dots (.):

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTYiLCJ1c2VyIjoiYWxpY2UiLCJleHAiOjE3NTAwMDAwMDB9.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
Segment 1: Header

Algorithm & Typ

Specifies the token type (typ: "JWT") and the cryptographic signing algorithm (such as alg: "HS256" or alg: "RS256").

Segment 2: Payload

The Claims

The heart of the token containing claims about the user (e.g. sub, username, roles) and timestamps (exp, iat).

Segment 3: Signature

Cryptographic Proof

Computed by hashing the header and payload with a secret or private key. Proves the token was not altered in transit.

The Biggest Misconception: Encoding vs. Encryption

⚠️ Base64URL Encoding Provides ZERO Secrecy

Many developers mistakenly believe that because a JWT looks scrambled, its contents are private. In truth, Base64URL is simply an encoding format (like translating text into binary or hex). Anyone with access to the token can decode it in milliseconds.

EncodingTransforms data into safe character formats. Reversible without a key.
Signing (JWS)Guarantees data integrity and origin. Readable by anyone, but tamper-proof.
Encryption (JWE)Hides the payload completely using ciphers. Unreadable without a key.

Standard Registered JWT Claims You Must Know

RFC 7519 defines seven standard registered claim names. While none are strictly mandatory, using them ensures interoperability across authentication frameworks:

ClaimFull NameMeaning & Example
issIssuerWho created the token (e.g. https://auth.silixen.shop/).
subSubjectWhom the token represents (e.g. user ID usr_948274).
audAudienceWho is allowed to accept the token (e.g. https://api.silixen.shop).
expExpiration TimeUnix epoch seconds after which the token must be rejected.
nbfNot BeforeUnix epoch seconds before which the token must not be accepted.
iatIssued AtUnix epoch timestamp when the token was created.
jtiJWT IDUnique nonce identifier used to track tokens or prevent replay attacks.

Top 4 Security Best Practices for Developers

  1. Never store sensitive secrets in claims: Do not place passwords, credit card numbers, or social security numbers into JWTs.
  2. Always enforce an expiration (exp): Access tokens should have short lifespans (typically 10 to 60 minutes). Use long-lived refresh tokens stored securely on the backend to issue fresh access tokens.
  3. Reject alg: none: Ensure your server-side verification library explicitly checks the algorithm and refuses unsigned tokens.
  4. Store tokens in HttpOnly cookies: Avoid storing access tokens in browser localStorage, where malicious third-party JavaScript or XSS attacks can read and exfiltrate them.

Want to see what is inside your JWT right now?

Use our privacy-focused decoder to inspect your token's claims, check expiration status, and verify formatting without uploading data to any server.

Open Free JWT Decoder →