What Is a JWT? JSON Web Tokens Explained Simply

Log in to a modern web or mobile app and there is a good chance the server hands your browser a long string starting with eyJ. Every request after that carries the string to prove who you are. That string is usually a JSON Web Token. So what is a JWT, what is inside it, and how do you use one safely? Here is a developer-friendly explanation without the jargon overload.

Screenshot of the JWT Decoder on Assen Tools
The JWT Decoder in use. Open the JWT Decoder – free, no sign-up.

The short answer

A JWT (pronounced "jot") is a compact, URL-safe JSON web token that carries a small set of facts – called claims – and a signature that proves the facts have not been changed. It is widely used for authentication (proving who a user is) and for passing information between services.

The three parts

A JWT looks like three Base64URL strings joined by dots:

xxxxx.yyyyy.zzzzz

  1. Header – the token type and signing algorithm, for example: {"alg":"HS256","typ":"JWT"} which encodes to eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
  2. Payload – the claims, such as the user ID and expiry time.
  3. Signature – created by signing the header and payload with a secret key (HS256) or a private key (RS256, ES256).

The "eyJ" at the start appears because {" always encodes to those characters in Base64. Read what is Base64 encoding to see why.

Common claims in the payload

  • sub – subject, usually the user ID
  • iat – issued at (a Unix timestamp)
  • exp – expiry time (a Unix timestamp)
  • iss – issuer, the service that created the token
  • aud – audience, who the token is meant for

Timestamps are in seconds since 1970 – convert them with the Unix Timestamp Converter or read what is a Unix timestamp.

How verification works

When the server receives a token, it recalculates the signature using its key. If anything in the header or payload was changed – even one character – the signatures will not match and the token is rejected. It also checks that the token has not expired.

The big misconception: JWTs are not secret

A standard signed JWT is encoded, not encrypted. Anyone who has the token can read the payload. The signature stops tampering, not reading. So:

  • Never put passwords, card numbers or sensitive personal data in a JWT payload.
  • Always send tokens over HTTPS.

Security tips

  • Keep tokens short-lived. Use an expiry of minutes or hours, with refresh tokens for longer sessions.
  • Always verify the signature on the server and reject tokens with "alg": "none".
  • Use strong secrets – long and random. The Password Generator can create one.
  • Store tokens carefully in browsers – HTTP-only cookies reduce the risk from cross-site scripting.
  • Plan for logout and revocation. Because JWTs are self-contained, revoking one before it expires needs extra design, such as a deny list or short lifetimes.

Inspect a token

The free JWT Decoder splits any token into its header and payload, formats the JSON and shows when it was issued and when it expires. It runs in your browser, so tokens are not sent to a server – but still avoid pasting live production tokens into any website you do not trust.

Related tools: Base64 Encode and Decode and the JSON Formatter – see how to format JSON.

Frequently asked questions

Is a JWT the same as a session cookie? No. A traditional session stores data on the server and gives the browser an ID. A JWT carries the data itself, which suits APIs and distributed systems.

Can I decode a JWT without the secret? Yes, you can read it. You need the key only to verify or create a valid signature.

What is the difference between HS256 and RS256? HS256 uses one shared secret. RS256 uses a private key to sign and a public key to verify.

Summary

So, what is a JWT? A signed, compact token made of a header, payload and signature, used to prove identity and pass claims between systems. It is readable by anyone, so keep secrets out of it, keep it short-lived and always verify the signature. Inspect any token with the free JWT Decoder.

Jonathan Nwachukwu, founder of Assen Tools

Written by

Jonathan Nwachukwu · Founder & developer

Jonathan is a freelance web developer and web development teacher who builds Laravel, WordPress and WooCommerce sites for clients. He built AssenTools to put the everyday file, photo and calculation jobs he kept doing for clients and students into one free, private toolbox, and he maintains every tool and guide on the site.