What Is a JWT? JSON Web Tokens Explained for Beginners

JSON Web Tokens (JWTs) are everywhere in modern apps: logins, API access, single sign-on and mobile sessions. A JWT looks like a long random string, but it is actually three pieces of readable JSON, encoded and joined with dots. Understanding them makes authentication bugs much easier to fix.

Free tool
Decode a JWT
Paste a token to see the header and payload as formatted JSON, with readable exp, iat and nbf dates, an expired or valid status, and optional HS256 verification. Nothing is sent to a server.
Open JWT Decoder →

The three parts

A JWT has the form xxxxx.yyyyy.zzzzz:

PartContainsExample
HeaderToken type and signing algorithm{“alg”:”HS256″,”typ”:”JWT”}
PayloadClaims – data about the user and token{“sub”:”42″,”exp”:1773484200}
SignatureProof the header and payload were not changedCreated with a secret or private key

The header and payload are Base64URL-encoded, not encrypted – see what is Base64. Anyone who has the token can read them.

Common claims

ClaimMeaning
subSubject – usually the user ID
issIssuer – who created the token
audAudience – who the token is for
expExpiry time (Unix timestamp)
iatIssued at
nbfNot valid before
jtiUnique token ID

Times are Unix timestamps in seconds – our JWT Decoder shows them as readable dates. See what is a Unix timestamp.

How verification works

  • HS256 (HMAC): the server signs and verifies with the same secret. Simple, but every service that verifies must know the secret.
  • RS256 / ES256: the issuer signs with a private key; anyone can verify with the public key. Common with identity providers and single sign-on.

A server must always verify the signature and the exp claim before trusting a token. Decoding is not verifying.

Security mistakes to avoid

  • Putting secrets in the payload – it is readable by anyone.
  • Accepting alg “none” or letting the token choose the algorithm – configure the expected algorithm on the server.
  • Weak HS256 secrets – use a long random secret.
  • Long-lived access tokens – keep them short (minutes) and use refresh tokens.
  • Pasting production tokens into tools that send them to a server – a live token is a key to an account. Our decoder runs entirely in your browser.

Where to store JWTs

  • Web apps: an HttpOnly, Secure, SameSite cookie protects the token from JavaScript (and XSS). localStorage is simpler but readable by any script on the page.
  • Mobile apps: the platform’s secure storage – Android Keystore-backed storage or the iOS Keychain.

JWT vs session cookies

Session cookies store an ID and keep user data on the server; they are easy to revoke. JWTs carry data in the token and suit APIs and distributed systems, but revoking them before expiry needs extra work (short expiry, deny lists). Neither is always better.

FAQ

Is a JWT encrypted?

Usually not. Standard signed JWTs are only encoded; anyone can read the payload. Encrypted JWTs (JWE) exist but are less common.

How do I know if a JWT is expired?

Compare the exp claim with the current Unix time, or paste it into the decoder.

Can I decode a JWT without the secret?

Yes. The secret is only needed to verify the signature.

What does HS256 mean?

HMAC with SHA-256 – a signature using a shared secret.

Is it safe to paste my token into the decoder?

Ours decodes in your browser and sends nothing, but avoid sharing live production tokens anywhere.

Free tool
Try the free JWT Decoder
No signup and nothing uploaded – it runs right in your browser. Browse all 74 free tools on our Free Tools page.
Open JWT Decoder →

Need a website or app for your business? Talk to Techpass Master – we design and build websites and apps for clients worldwide.

WhatsApp us📞 Call now