Developer Tools

What Is a JWT? JSON Web Tokens Explained Simply

Log into most modern apps and you receive a JWT – a compact token that proves who you are. Here is what is inside one and how to debug the common problems.

In this article
  1. The three parts
  2. Standard claims
  3. How to decode a token
  4. Debugging common login problems
  5. Where tokens are stored
  6. Security rules for JWTs
  7. Related tools

The three parts

A JWT looks like three blocks of letters joined by dots: xxxxx.yyyyy.zzzzz.

  • Header – which algorithm signed the token, e.g. {"alg":"HS256","typ":"JWT"}.
  • Payload – the claims: who the user is, roles, and when the token expires.
  • Signature – proof that the server created the token and nobody changed it.

The header and payload are only Base64URL-encoded, not encrypted. Anyone holding the token can read them. The signature stops people changing them, not reading them.

JWT DecoderDecode a JSON Web Token to read its header and payload, see exp, iat and nbf as real dates, check whether it has expired and verify an HS256 signature.
Open the free tool

Standard claims

ClaimMeaning
subSubject – usually the user ID
issIssuer – who created the token
audAudience – which app it is meant for
expExpiry time (Unix seconds)
iatIssued at
nbfNot valid before

How to decode a token

  1. Copy the token – often from the browser’s developer tools (Network or Application tab) or an Authorization header.
  2. Paste it into the JWT Decoder; a “Bearer ” prefix is removed automatically.
  3. Read the pretty-printed header and payload. Time claims are shown as local dates with a status: valid, expired or not yet valid.
  4. If you have the secret for an HS256/384/512 token, enter it to verify the signature.

Debugging common login problems

  • Logged out too soon: compare exp with iat. A token valid for 300 seconds instead of 300 minutes is a classic unit mistake.
  • “Invalid audience” or “invalid issuer”: check aud and iss against your server configuration.
  • Token not yet valid: a device clock that is ahead or behind causes nbf and exp problems. Check the computer’s time.
  • Missing permissions: look for role or scope claims in the payload.

Where tokens are stored

Web apps keep tokens in cookies, localStorage or memory. Cookies marked HttpOnly cannot be read by JavaScript, which protects them from many cross-site scripting attacks; tokens in localStorage are easier to use but more exposed if a site has a script injection flaw. Mobile apps store them in the operating system’s secure storage. When debugging, check where your app keeps the token and whether it is being sent with each request.

Security rules for JWTs

  • Never put secrets or sensitive personal data in the payload – it is readable.
  • Servers must verify the signature and reject "alg": "none".
  • Keep access tokens short-lived and use refresh tokens for longer sessions.
  • Treat tokens like passwords: do not paste live production tokens into tickets, chats or untrusted websites.

ConvertNest decodes tokens entirely in your browser. Even so, prefer testing with tokens from development environments.

Decode individual Base64URL parts with the Base64 Decoder, convert timestamps with the Timestamp Converter, and pretty-print other JSON with the JSON Formatter.

JWT DecoderDecode a JSON Web Token to read its header and payload, see exp, iat and nbf as real dates, check whether it has expired and verify an HS256 signature.
Open the free tool
Keep reading

Related articles

All articles
Dev

How to Decode Base64 into Text, an Image or a File

A long string of random-looking letters in a log, an email or an API response is often Base64. Here is how to see what is really inside.

3 min read
Dev

How to Read JSON – A Beginner’s Guide to API Responses

Almost every app and website exchanges data as JSON. Once you can read its structure, error messages and API responses stop looking like noise.

3 min read
Dev

Unix Timestamps Explained – Seconds, Milliseconds and Time Zones

Numbers like 1767225600 appear in logs, APIs and databases. They are simply a count of seconds – once you know the rules, converting them is easy.

3 min read