Runs in your browser — nothing you enter leaves this pageRFC 7519 / RFC 7515 · HS256 · HS384 · HS512 · Ruby jwt gem 3.x · Devise-JWT 0.13
Paste a JWT, with or without "Bearer ". It is decoded in this tab and never put in a link or stored.

Checked with WebCrypto in this tab. Never stored, never in a link, cleared when you leave the page.

Like the jwt gem's leeway option: exp and nbf may be off by this much.

A JSON Web Token is three base64url segments separated by dots: a header, a payload of claims, and a signature. Anyone holding the token can read the first two; only someone with the key can produce a matching signature. This tool decodes both JSON parts, explains the time claims, and checks HMAC signatures when you give it the secret.

How it works

Each segment is decoded with base64url, the URL-safe Base64 alphabet that writes - and _ instead of + and / and drops the = padding. A segment with characters from the wrong alphabet, an impossible length, bytes that are not UTF-8, or text that is not a JSON object is rejected with a message that says which segment failed and why. A leading Bearer and stray line breaks are removed for you, with a note, because they are common copy-and-paste accidents.

The claims table lists every claim in order. exp, iat and nbf are NumericDates, seconds since 1970, and are shown in UTC, in your browser’s time zone, and relative to now. The checks follow RFC 7519: a token is expired from the second exp is reached, and not yet valid before nbf. The leeway field widens both, the way the jwt gem’s leeway: option does. Values in milliseconds or in quotes are pointed out, because they silently break expiry checks in some libraries.

For HS256, HS384 and HS512 the signature is checked with the browser’s WebCrypto API: the secret is imported as an HMAC key and crypto.subtle.verify compares the signature against the first two segments, byte for byte as they appear in the token. The secret field is a password field, is never stored or put in a link, and is cleared when you leave the page. The copied result contains the decoded JSON and the verdict, never the token or the secret.

A worked example

RFC 7515 example with key loads the token from RFC 7515 Appendix A.1, which RFC 7519 also uses as its first example, together with its 64-byte key in base64url form. The header is {"typ":"JWT", "alg":"HS256"}, with a line break inside it that the RFC includes on purpose. The claims are iss “joe”, exp 1300819380 and a custom claim, http://example.com/is_root.

The verdict reads Signature valid · expired. The signature matches, but exp is 22 March 2011 at 18:43:00 UTC, so the token stopped being valid long ago. Switch the secret format to Text and the same characters become a different key: the verdict turns to Signature invalid. That one setting is behind many “invalid signature” reports.

alg: none example loads an unsigned token that claims "admin": true. It decodes like any other, which is exactly the danger: the tool flags it as unsigned and warns never to accept it.

Ruby and Rails

With the jwt gem, JWT.decode(token, secret, true, algorithm: "HS256") verifies the signature and the time claims, and raises JWT::ExpiredSignature once exp has passed. Always name the algorithm. Verifying with a fixed list is what stops an attacker from switching a token to none, or to HS256 signed with your RSA public key. Passing false as the third argument decodes without checking anything, which is what this page does before you enter a secret. That is fine for debugging and wrong anywhere near authentication.

Devise-JWT, through warden-jwt_auth, signs with HS256 by default and puts sub (the user id), scp (the Devise scope), iat, exp and jti in every token, with exp one hour after iat unless you change expiration_time. The lifetime warning shows that hour. With the JTIMatcher revocation strategy, the jti claim must equal the user’s jti column, so a token that decodes and verifies here can still be refused after sign-out.

Keep the secret in Rails credentials or an environment variable, at least 32 random bytes for HS256 (SecureRandom.hex(64) gives plenty). The tool warns when a secret is shorter than RFC 7518 requires for the algorithm, because a short HMAC secret can be guessed offline from any single token.

Limitations

More tools are on the developer tools page.

Frequently asked questions

Is it safe to paste a production token here?

The token is decoded and checked in this tab; the page makes no network requests and keeps nothing. Both fields are emptied when you leave the page, and this tool has no share link, so a token never ends up in a URL. Still, a live token is a credential: prefer an expired one or one from staging, and treat any token you have pasted somewhere you do not trust as leaked.

The secret is right, so why does the signature show as invalid?

Usually the secret is in a different form from the one the server signs with. Most Rails apps pass the secret string as is, so choose Text. If your secret is stored as Base64 bytes, choose Base64. Also check for a trailing newline copied from an environment file, and that you are using the secret of the environment that issued the token.

Why can it not verify RS256 tokens?

RS256 and ES256 tokens are signed with a private key and verified with a public key, which this tool does not import yet. It still decodes them and checks their dates. HS256, HS384 and HS512 use one shared secret, which WebCrypto can check directly.

Why is my token expired here while the server still accepts it?

The server may allow some clock leeway, and its clock may differ from yours. The Ruby jwt gem accepts a leeway option, and Devise-JWT tokens expire one hour after issue unless you change expiration_time. Set the same leeway here to see what the server sees.

Get new articles by email

Deep dives on Rails reliability, when they're published. No spam.