How-To Guides · Intermediate

What Is a JWT Token? Header, Payload, Claims & Security

Learn what a JSON Web Token (JWT) is, how its header, payload and signature work, what claims such as exp and aud mean, and why decoding is not verification.

8 min read By Editagram Team Updated
jwtsecurityauthenticationtokens

What is a JSON Web Token (JWT)?

A JSON Web Token is a compact, URL-safe format for carrying claims between systems. Applications commonly use signed JWTs to pass information about an authenticated user or a permitted action. A token is a data format—not a complete authentication system by itself. The application issuing and receiving it must define how it is created, validated, expired and revoked.

The parts of a signed JWT

A compact signed JWT (JWS) commonly has three Base64URL-encoded segments separated by periods: header.payload.signature. The header describes the token type and signing algorithm, the payload contains claims, and the signature protects the signed content against undetected modification. Encrypted JWTs (JWE) use a different compact structure and can contain five segments.

JWT header: token type and algorithm

The header is a JSON object that commonly includes "typ" with the value "JWT" and "alg" identifying the signing algorithm. Some systems also use a "kid" key identifier to help select a verification key. A header value is metadata supplied with the token; a verifier must not blindly trust it to decide which algorithms or keys are allowed.

JWT payload: claims and identity data

The payload is a JSON object containing claims—statements about a subject or other information. Registered claim names include "iss" (issuer), "sub" (subject), "aud" (audience), "exp" (expiration time), "nbf" (not before), "iat" (issued at) and "jti" (JWT ID). Applications can also define private claim names for their own needs.

What do exp, nbf, iss and aud mean?

The "exp" claim sets the time after which a token must not be accepted; "nbf" says the token must not be accepted before a specified time. "iss" identifies the issuer and "aud" identifies the intended recipient. JWT NumericDate values are expressed in seconds since the Unix epoch. A verifier should check the claims required by its application, not merely confirm that the JSON can be decoded.

Base64URL decoding is not encryption

The first two segments of a typical signed JWT are encoded, not encrypted. Anyone who obtains the token can usually decode and read its header and payload. Do not place passwords, private keys, payment details or other secrets in a normal signed JWT payload. Encryption is a separate JWT option and must be deliberately implemented and validated.

Decoding is not signature verification

Decoding only reveals the encoded JSON. It does not prove who created the token or whether its contents were changed. Signature verification requires the correct trusted key and an approved algorithm. A verifier must also validate the claims required by the application, including issuer, audience, expiration and any not-before time.

JWT verification and common security mistakes

Use a maintained JWT library and configure an explicit allow-list of expected algorithms. Do not select an algorithm solely because the untrusted token header requests it. Validate the signing key, issuer, audience and time-based claims; handle key rotation; and reject tokens that fail any required check. Avoid custom cryptographic code and never treat a decoded token as authenticated.

Where should an application store a JWT?

Storage choices depend on the application architecture and threat model. JavaScript-readable browser storage can expose tokens to cross-site scripting if the page is compromised. Secure, HttpOnly and appropriately configured SameSite cookies can reduce direct script access, but cookie-based designs need CSRF protections. Do not log bearer tokens, put them in URLs, or share them in screenshots or support tickets.

Inspect a token safely with Editagram

The Editagram JWT Decoder can display the header and payload locally in your browser so you can inspect claim names and values. It is a decoder, not a signature verifier, and its output must not be used as proof that a token is valid. For safety, use a fabricated or redacted example whenever possible and do not paste a live production bearer token into a tool unless you have assessed the risk.

Frequently Asked Questions

Is a JWT encrypted?

Not necessarily. A common signed JWT protects integrity with a signature but does not hide the header or payload. Anyone who obtains it can usually decode those sections. JWT encryption is a separate format and configuration.

What are the three parts of a JWT token?

A compact signed JWT commonly contains a header, payload and signature separated by periods. The header describes signing metadata, the payload carries claims, and the signature allows a verifier to check integrity and authenticity.

Can I verify a JWT signature with the Editagram JWT Decoder?

No. The decoder displays the header and payload; it does not verify the signature or validate issuer, audience or expiry. Use a trusted JWT verification library in the application that owns the token.

What does the exp claim mean in a JWT?

The exp claim is the expiration time after which a JWT must not be accepted. Its NumericDate value is expressed in seconds since the Unix epoch, subject to any small clock-skew allowance configured by the verifier.

Is it safe to share a JWT token?

Treat a bearer token as a credential. Do not post it publicly, include it in logs or screenshots, or send it to support unless it has been safely redacted or revoked.

Related Tools

  • JWT Decoder

    Decode JWT tokens to inspect header and payload. For inspection only, not verification.

  • Random Token Generator

    Generate cryptographically secure random tokens for API keys and sessions.

  • Text Encryptor

    Encrypt and decrypt text using AES-256-GCM with password-derived keys.

Related Guides

Explore more learning resources in Editagram Academy.