What is a JWT?

A JWT (JSON Web Token) is a compact token that proves who you are to a website or an API. After you log in, the server hands your browser or app a token, and each request sends it back, usually in an Authorization: Bearer header. A token has three parts joined by dots, in the pattern xxxxx.yyyyy.zzzzz: a header that names the signing algorithm, a payload with claims such as the user (sub) and the expiry time (exp), and a signature. Each part is written in URL-safe Base64, and since the header is JSON that starts with {", most tokens start with eyJ.

You'd check a token's shape when a login or an API call fails and you want to rule out a token that got cut off or mangled while copying.

Tool description

Paste a token into the JWT box, and the result shows as you type: "JWT is valid" or "JWT is not valid". Spaces and line breaks around the token are ignored, but a line break inside it makes it fail, so join a token that was split over several lines. The page has no settings.

What the check looks at

The check looks only at the token's structure. A token passes when it has:

  • Exactly two dots, so three parts: encrypted tokens (JWE), which have five parts, fail
  • Only letters, digits, hyphens and underscores in each part
  • No +, / or =, which belong to standard Base64, not to the URL-safe form that tokens use

A part may be empty, so an unsigned token, which ends in a dot, passes.

What it doesn't check

  • The signature: checking it takes the secret the token was signed with, or the matching public key
  • The expiry time and the other claims: an expired token passes
  • Whether the parts decode to JSON: picnic.basket.lemonade passes, and so do two dots alone

So "JWT is valid" means the text is shaped like a token, not that a server will accept it.

Good to know

  • Copy the token without the word Bearer and the space after it, and without quotes: both make it fail.
  • To decode a token, see when it expires and check an HMAC signature, use the JWT parser. To make a signed token for testing, use the JWT Generator.

Features

  • Checks the three-part structure of a JSON Web Token
  • Flags characters that don't belong in URL-safe Base64
  • Ignores spaces and line breaks around a pasted token
  • Runs in your browser, so nothing you type is sent anywhere