How to Decode a JWT and Read Its Claims

Learn JWT header, payload, and signature, Base64URL claims, expiration checks, and why decoding is not the same as verification.

By Generatr Team

Decoding a JWT means splitting the token into header, payload, and signature segments, Base64URL-decoding the first two, and reading the JSON claims inside. You do this to debug auth bugs, confirm scopes, and check exp times — not to prove the token is authentic by itself.

This guide explains structure, common claims, expiration, Base64URL, and the critical line between decode and verify. Inspect tokens with the free JWT decoder — header, payload, signature view, and expiration status in your browser.

Never paste production refresh tokens into random websites if your policy forbids it. Prefer client-side tools and redact secrets when you share screenshots.

Free tool

Use the JWT Decoder now

Open the interactive jwt decoder in your browser — free, instant, no signup.

Open JWT Decoder

What Is a JWT and What Problems Does It Solve?

A JSON Web Token (JWT) is a compact string that carries JSON claims between parties. APIs often send access tokens as JWTs so a resource server can read subject, roles, and expiry without a database hit on every request — when the signature is verified with the right key.

The wire format is three Base64URL parts joined by dots:

header.payload.signature

  • Header — typically algorithm (alg) and type (typ: JWT)
  • Payload — claims such as sub, iss, aud, exp, iat, plus custom fields
  • Signature — integrity check bytes (still encoded); verifying needs the secret or public key

Open the JWT decoder and paste a sample token to see each part. Pretty-print claim JSON with a JSON formatter when you copy payload fields into notes.

How Do Header, Payload, and Signature Fit Together?

Each segment is Base64URL-encoded. Decoding header and payload yields JSON objects. The signature segment is not “the password”; it is a cryptographic check over header.payload using the algorithm named in the header.

Header examples

  • alg: HS256, RS256, ES256, and others
  • typ: usually JWT
  • kid: key id when multiple signing keys rotate

Payload examples

  • sub — subject (user or service id)
  • iss — issuer
  • aud — audience
  • exp — expiration (Unix time)
  • iat — issued-at
  • nbf — not-before

Custom claims are allowed; treat them as application data. Anything in the payload is readable to anyone who has the token — JWT is not encryption unless you use nested JWE patterns.

For the encoding layer underneath, read how Base64 (and variants) work. JWTs use Base64URL: - and _ instead of + and /, and padding is often omitted.

Why Must You Never Treat Decode as Verify?

Decode only reverses encoding so you can read JSON. Verify checks that a trusted party signed the token and that critical claims (issuer, audience, time) pass policy.

  • Anyone can craft a JWT-shaped string with a fake payload
  • A decoder will happily show those fake claims
  • Without signature verification against the correct key, claims are untrusted input

Common verification steps (in your app, not only in a browser toy)

  1. Parse and validate structure.
  2. Verify signature with the issuer’s JWKS or shared secret.
  3. Reject surprising alg values (especially none).
  4. Check exp, nbf, iss, aud against your rules.
  5. Authorize using scopes/roles only after the above succeeds.

Online decoders that do not ask for a key are decode-only by design — useful for inspection, incomplete for auth. Production libraries in your language should perform verify. Decoding in DevTools while debugging is fine; skipping verify in the API is not.

How Do Expiration and Time Claims Work?

Time claims are usually Unix timestamps in seconds since the epoch. A token with exp in the past should be rejected by verifiers. Decoders often highlight expired vs active status for quick triage.

  • exp — stop accepting after this instant (with optional small clock skew)
  • nbf — do not accept before this instant
  • iat — when the token was issued; useful for session age and revoke windows

If a log shows a raw number and you need a calendar time, follow the Unix timestamp guide. Mixing seconds and milliseconds is a frequent bug: JWT numeric dates are seconds; JavaScript Date.now() is milliseconds.

Debugging “invalid token” errors

Check clock skew between laptop and server, wrong environment’s signing key, audience mismatch, and copied tokens that were truncated in chat apps. Decode first to see claims; then verify in the stack that issued the error.

How Does Base64URL Encoding Affect What You See?

Standard Base64 and Base64URL are siblings. URL-safe alphabets avoid characters that break query strings. Padding = may be stripped in JWTs. If you manually decode a segment with a generic Base64 tool, you may need to restore padding or switch to a URL-safe mode.

  • Split on . — you should get three parts for a typical JWS JWT
  • Decode part 1 and part 2 as Base64URL → UTF-8 JSON
  • Leave part 3 as opaque signature bytes unless you are implementing crypto

Practice generic encode/decode via the Base64 tools when needed, but prefer a dedicated JWT decoder so header/payload split and claim formatting are automatic.

Malformed JSON inside a payload means a corrupt token or a non-JWT string. Validate structure before you assume claim names.

How Should You Debug JWTs Without Creating Risk?

Tokens can grant access. Treat them like session cookies.

  • Prefer staging tokens when you only need structure demos
  • Use client-side decoders so the string is not uploaded if the tool is honest about local processing
  • Redact screenshots: subject ids, emails, and internal URLs still leak from payloads
  • Do not log full tokens in shared production logs if policy forbids it
  • Rotate if a live access token was pasted into an untrusted channel

Signature algorithms and key handling belong in your auth service. Hashing tools can illustrate digests for teaching but do not verify a JWT by hashing the payload alone — verification follows the JWS algorithm with the correct key material. See the hash generator only for separate digest experiments, not as a JWT verifier.

User identifiers inside tokens are often UUIDs; for ID format context, see the UUID guide.

How Do You Use an Online JWT Decoder Step by Step?

Use this flow when an API returns 401s or a client stores a token you need to inspect.

  1. Copy the full JWT string (all three segments, no spaces).
  2. Open the free JWT decoder.
  3. Paste the token into the input.
  4. Read the header: algorithm and type should match your issuer’s docs.
  5. Read the payload: subject, roles/scopes, and custom claims.
  6. Check expiration status and compare exp/iat to wall-clock time if needed.
  7. Remember: readable claims ≠ verified claims — confirm signature verification in your application.

If the paste fails to parse, you may have a truncated token, a Bearer prefix still attached, or an encrypted JWE (different structure). Strip Bearer if present and confirm you are looking at a three-part JWS JWT.

Step-by-Step Instructions

  1. 1Copy the complete JWT string including all three dot-separated segments.
  2. 2Open the free JWT decoder on Generatr.
  3. 3Paste the token into the decoder input (remove a leading Bearer prefix if needed).
  4. 4Inspect the decoded header for algorithm (alg), type (typ), and key id if present.
  5. 5Inspect the payload claims such as sub, iss, aud, scopes, and custom fields.
  6. 6Check expiration status and convert exp or iat with a timestamp tool if you need wall-clock time.
  7. 7Copy claim JSON for notes or format it in a JSON formatter for readability.
  8. 8Verify the token in your application with the correct key — never treat decode-only output as authentication proof.

Frequently Asked Questions

How do I decode a JWT?+

Split the token on periods, Base64URL-decode the header and payload, and parse the JSON. A JWT decoder automates that and shows expiration. Decoding does not validate the signature.

What is the difference between decoding and verifying a JWT?+

Decoding only reveals claims. Verifying checks the signature with a trusted key and enforces time and issuer rules. Unverified claims must be treated as untrusted input.

Why is my JWT showing as expired?+

The exp claim is a Unix time in seconds. If the current time is past exp (beyond allowed skew), verifiers reject the token. Compare exp with a timestamp converter and check device clock accuracy.

Can anyone read my JWT payload?+

Yes, anyone who has the token can decode the payload unless you use encryption (JWE). Do not put passwords or highly sensitive secrets in JWT claims.

Do I need a secret key to decode a JWT?+

No. Header and payload are encoded, not encrypted, in a standard signed JWT. You need the key only to verify the signature or to decrypt a JWE.

Is Generatr’s JWT decoder free and private?+

Yes. It is designed for client-side inspection of header, payload, signature, and expiration without requiring an account. Still avoid pasting high-value production tokens into any tool when policy forbids it.

Ready to try it yourself?

Use the free JWT Decoder — no download, no account.

Launch JWT Decoder