A JSON Web Token (JWT) is a compact, signed string that carries claims, such as a user ID and an expiry time, so one system can pass verified information to another.

Definition
A JSON Web Token is an open standard format for securely transmitting a small set of facts, called claims, between parties. A JWT looks like three chunks of encoded text separated by dots. Inside are a header describing how the token is signed, a payload of claims, and a signature that lets the receiver check the token was issued by a trusted party and has not been altered.
JWTs are widely used for authentication and authorization in web and mobile apps. After a user signs in, a server or identity provider issues a token stating who the user is, what they may access and when the token expires. The client sends it with later requests, and APIs can validate it locally using a key, without looking up a session in a database.

How it works
The header is a small JSON object naming the token type and the signing algorithm, for example an HMAC algorithm with a shared secret or an RSA or elliptic curve algorithm with a public and private key pair. The payload is another JSON object with claims. Some are registered names defined by the standard, such as sub for the subject, iss for the issuer, aud for the intended audience and exp for the expiry time. Others are custom, such as a role or tenant ID.
Each part is base64url encoded, and the signature is computed over the encoded header and payload using the chosen key. Encoding is not encryption: anyone holding the token can decode and read the payload. What the signature guarantees is integrity and origin. If someone changes a single character in the payload, the signature no longer matches and the token is rejected. When confidentiality is needed, a related standard called JWE encrypts the contents.
To validate a token, the receiving API checks the signature with the right key, confirms the algorithm is one it expects, and verifies the claims: that the token has not expired, that it came from the expected issuer and that it was meant for this audience. Because validation needs no database call, JWTs suit distributed systems and microservices, but it also means a token stays valid until it expires unless the system adds a revocation check.
Keep learning
Put it into practice
Well-designed APIs and dependable third-party integrations that connect your products, partners and internal systems.
Explore serviceSecurity audits, threat monitoring, incident response and network security delivered as an ongoing, leadership-led managed security program.
Explore serviceFast, secure and accessible web applications built with React and Next.js, designed for real users and real traffic.
Explore serviceFAQ
A standard signed JWT is not encrypted. Its header and payload are only encoded, so anyone with the token can read them. The signature prevents tampering, not reading. If the contents must stay private, use an encrypted token format such as JWE, or keep sensitive data on the server and put only an identifier in the token.
Both work. Server-side sessions are simple to revoke and suit traditional web apps on one domain. JWTs suit APIs consumed by several clients and distributed services that need to validate requests without a shared session store. Many systems combine them, using short-lived JWTs with refresh tokens managed on the server.
There is no perfect answer, but a common recommendation is an HttpOnly, Secure cookie with an appropriate SameSite setting, which keeps the token out of reach of JavaScript and reduces exposure to cross-site scripting. Browser local storage is convenient but readable by any script on the page.
Talk to a solution architect about where it fits in your roadmap.
