OOmnistu

Blog / Security

Security

JWT explained: what a JSON Web Token is and how to read one

A JWT is a compact, URL-safe envelope for JSON claims - the parts of a signed token, the registered claim names, and why decoding one is not the same as verifying it.

OOmnistu
Reviewed 2026-11-20 · 4 min read

A JSON Web Token - JWT - is, per RFC 7519, a compact, URL-safe means of representing claims to be transferred between two parties. The claims are encoded as a JSON object and used as the payload of a JSON Web Signature structure, where they are digitally signed or integrity-protected with a Message Authentication Code, or as the plaintext of a JSON Web Encryption structure, where they are encrypted. This guide covers what is inside one and what the current best-practice document says about verifying them.

The three parts

In the compact form used in practice, a signed JWT is three Base64url-encoded parts joined by dots: the protected header, the payload, and the signature. The header - the JOSE header - describes the cryptographic operations applied to the claims, such as the alg parameter naming the signing algorithm. The payload is the claims set itself, a JSON object of name-value pairs. The signature (or MAC) is what lets the recipient check that the first two parts were not altered in transit. An encrypted JWT uses a different compact serialization with five parts - the protected header, encrypted key, initialization vector, ciphertext and authentication tag, per RFC 7516 - and its claims are not readable without decryption.

Claims: registered, public, private

The specification registers a small set of claim names in the IANA JSON Web Token Claims registry. Among them: iss identifies the principal that issued the JWT; sub identifies the principal that is the subject of the JWT; aud identifies the recipients the JWT is intended for, and a principal that is not identified by it must reject the token; exp sets the expiration time after which the JWT must not be accepted; and nbf sets a time before which the JWT must not be accepted. Applications can also use public claim names they agree on, or private ones for their own use.

Decoding is not verifying

Because the parts are only Base64url-encoded, anyone can read a JWT's header and claims. Trust comes from validation, and the Best Current Practices document for JWTs (RFC 8725, which updates RFC 7519) is specific about it: libraries must let the caller specify the set of acceptable algorithms and must not use any other; the alg header must match the algorithm actually used; each key must be used with exactly one algorithm; libraries should not generate or consume tokens using the "none" algorithm unless the caller explicitly requests it; and human-memorizable passwords must not be used as HMAC keys. An attacker who can swap the algorithm or the key can make a forged token pass a careless check.

The calm version

A JWT is a signed, URL-safe envelope for JSON claims - header, payload, signature, joined by dots. Read the registered claims for who issued it, who it is about, who it is for, and when it stops being valid, and verify the signature against an explicit algorithm allowlist before trusting any of it.

Sources: RFC 7519, JSON Web Token (JWT) (IETF, May 2015; rfc-editor.org/rfc/rfc7519, fetched 2026-11-20): the definition, JOSE header, and registered claim names iss/sub/aud/exp/nbf. RFC 7515, JSON Web Signature (JWS), section 7.1 (rfc-editor.org/rfc/rfc7515, fetched 2026-11-20): the compact serialization of header, payload and signature. RFC 7516, JSON Web Encryption (JWE), section 7.1 (rfc-editor.org/rfc/rfc7516, fetched 2026-11-20): the five-part compact serialization for encrypted tokens. RFC 8725, JSON Web Token Best Current Practices (IETF, February 2025; rfc-editor.org/rfc/rfc8725, fetched 2026-11-20): algorithm verification requirements, the "none" algorithm, and key guidance.

Frequently asked questions

What is a JWT?

Per RFC 7519, a compact, URL-safe means of representing claims between two parties - a JSON object of claims, digitally signed, MACed or encrypted within a JWS or JWE structure.

What are the parts of a signed JWT?

In the compact form of a signed token (a JWS): the Base64url-encoded protected header, payload (the claims set) and signature, joined by dots - per the JWS compact serialization in RFC 7515. An encrypted JWT (a JWE) uses its own five-part compact serialization per RFC 7516.

Is decoding a JWT the same as verifying it?

No. Anyone can decode the header and claims. Verification means checking the signature with an explicit set of acceptable algorithms - the JWT Best Current Practices document (RFC 8725) spells out those requirements.

What do iss, sub, aud and exp mean in a JWT?

Registered claim names from RFC 7519: iss is the issuer, sub the subject, aud the intended audience (a recipient not identified by it must reject the token), and exp the expiration time after which the token must not be accepted.