Guide

JWTs explained: what the signature proves

Reviewed 23 November 2026 · 7 min read · Written and maintained by Toolnexo

A JSON Web Token looks like a random string with two dots in it, and it is often described as secure. It is signed, which is not the same as secret. This guide explains how a token is built, why its contents can be read by anyone who holds it, what the signature does protect against and which checks it leaves to your own code. The token and the signature values below were produced with the JWT generator on this site, which signs in your browser with the Web Crypto API, so the secret and payload are not uploaded.

Three parts joined by dots

A JWT is a header, a payload and a signature, each written in base64url and separated by dots. The header says how the token is signed. For HS256 it is {"alg":"HS256","typ":"JWT"}, which encodes to eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9. The payload holds the claims, such as who the token is about and when it was issued.

Base64url is the ordinary base64 alphabet with - and _ in place of + and / and no = padding, so a token can sit in a URL or a header without being changed. It is an encoding, not encryption. Anyone can reverse it with no key.

The payload is readable by everyone

Decode the payload of the example token and you see {"sub":"1234567890","name":"John Doe","iat":1516239022}. The iat value is seconds since 1 January 1970 and means the token was issued at 2018-01-18 01:30:22 UTC. You did not need any secret to read it, and neither does anyone who sees the token in a log, a screenshot or a browser tool.

So never put passwords, personal data you would not want read or other secrets in a payload. Put in only what the receiver needs, such as an identifier and an expiry, and keep everything else on the server.

How the signature is made

For HS256 the signature is an HMAC with the SHA-256 hash, computed over the text header.payload using your secret as the key, then written in base64url. With the secret your-256-bit-secret and the payload above, the signature is SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c, and the full token is the three parts joined together.

HS384 and HS512 work the same way with longer hashes. All three are symmetric: the same secret signs and verifies, so both sides must know it and keep it private. RS256, ES256 and the other key pair algorithms use a private key to sign and a public key to verify. The generator supports only the HMAC family.

What a valid signature does prove

It proves the token was not changed after it was signed, and that whoever signed it knew the secret. Try it: change the payload of the example token to add "admin":true, keep the original signature and ask the checker to verify it with the right secret. It answers that the signature does not match, because the HMAC of the new text is different. Changing a single character of the header or payload has the same effect.

That is the useful property. A server can hand out tokens, then trust the claims in a returned token without looking anything up, as long as the signature checks out.

What it does not prove

  • It does not check that the token has not expired. The exp claim is just a number, and your code has to compare it with the clock. The generator can add iat and exp for you, but checking a signature does not look at them.
  • It does not check who the token is for or who issued it. Claims such as aud (audience) and iss (issuer) must be checked by the receiver.
  • It does not hide anything. See the payload section above.
  • It cannot cancel a token. Because the server needs no lookup, it also has no list to remove a token from, so short expiry times limit the harm from a stolen token.

Two traps to know about

The first is alg none. A token whose header says alg is none has no signature at all, and a careless server that trusts the header would accept it. Servers should decide the allowed algorithm themselves instead of believing the token. The checker here refuses such a token and tells you not to trust it.

The second is a weak secret. An HS256 secret should be at least as long as the hash output, which is 32 bytes, and random. A short secret still signs, and the generator shows a warning, because a short one can be guessed by trying many candidates offline against a token. Remember also that the secret is used as plain UTF-8 text in this tool, not decoded from base64. If your server base64-decodes its secret, enter the decoded value here.

Using the tools

  • Use the JWT generator to create a test token with HS256, HS384 or HS512 and to check a token's signature against a secret.
  • Use the JWT decoder to read the header and payload of any token, including its issued and expiry times, and to verify its signature with an HMAC secret or an RSA or EC public key (PEM, JWK or JWKS).
  • Use test secrets in any browser tool and keep your production secrets on your own servers.
Tools in this guide

Put it into practice

How this guide is maintained

This page is reviewed when the related tools change. It describes what the published tools actually do: the tools run in your browser tab, so your files stay on your device. If you find something inaccurate, email [email protected] and it will be corrected.

Keep reading

Other guides

All guides →