# JSON Web Token (JWT)

> A signed token in three parts. It carries facts about a user.

**Field:** Software Development  
**Category:** Auth  
**Also known as:** JWT, JWTs, jot

## Think of it like

Think of it like a sealed note. Anyone can read it, but a broken seal shows it was changed.

## Definition

A JSON Web Token is a small, signed token that carries facts about a user. It has three parts joined by dots: a header, a payload of facts and a signature. The payload might say the user's ID and when the token runs out. The server checks the signature, so it can trust the facts without looking them up. The payload is only encoded, not hidden, so it must never hold secrets.

## Example

Lucy's API reads the JWT on each request. The payload says user 42, expires at 1 January 2026, and the valid signature means it can be trusted.

## Example code

```json
{
  "sub": "42",
  "name": "Lucy",
  "exp": 1767225600
}
```

The payload: user 42, and exp is midnight on 1 January 2026 in UTC.

## Why it matters

A server can check a JWT without asking a database. That helps when many servers share the work.

## Common mistake

Putting private data in the payload. Anyone can read it in seconds; the signature only stops changes.

## Three principles

- **Three parts.** Header, payload, signature.
- **Signed, not hidden.** Readable by anyone.
- **Checked without lookup.** The signature is the proof.

## Related terms

- [Access Token](https://learn.benibix.com/term/development/access-token)
- [JavaScript Object Notation (JSON)](https://learn.benibix.com/term/development/json)
- [Refresh Token](https://learn.benibix.com/term/development/refresh-token)
- [OpenID Connect (OIDC)](https://learn.benibix.com/term/development/openid-connect)
- [Digital Signature](https://learn.benibix.com/term/development/digital-signature)

## Told apart from

- [Session vs JWT](https://learn.benibix.com/compare/session-vs-jwt): A session keeps your login on the server, while a JSON Web Token carries it inside the token. With a session, the browser holds only an ID. The server looks it up on each request. A JWT holds the facts and a signature, so the server can check it with no lookup. A session can be ended at once; a JWT stays good until it runs out.

---

Source: https://learn.benibix.com/term/development/json-web-token
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
