JWT sign and verify
Create a signed JSON Web Token from a header and payload, or verify a token's signature, with HS256/384/512, RS256/384/512, PS256/384/512 and ES256/384/512. Keys stay in your browser.
About JWT sign and verify
Creates a signed JSON Web Token from a header and payload you write, and verifies the signature of an existing token. It supports HMAC (HS256/384/512), RSA (RS and PS) and ECDSA (ES256/384/512), using your browser's built-in Web Crypto, so keys never leave the page.
When you would use it
- Generating test tokens with exactly the claims, expiry and algorithm your API needs, without writing a script.
- Checking whether a token's signature matches a given secret or public key while debugging a 401 or an invalid signature error.
- Trying an algorithm (HS256 versus RS256 versus ES256) before wiring it into a service.
How to use it
- Choose the algorithm, then edit the header and payload JSON. The alg field is set for you, and typ defaults to JWT.
- For HS algorithms enter a shared secret (as UTF-8 text or base64url). For RS, PS and ES algorithms paste a private key, or use the button that generates a key pair.
- Copy the signed token. To verify, paste a token into the verify section with the secret or the public key and read the result.
Things worth knowing
- Private keys must be PKCS#8 PEM, starting with -----BEGIN PRIVATE KEY-----. A key that starts with BEGIN RSA PRIVATE KEY or BEGIN EC PRIVATE KEY is not accepted; convert it with: openssl pkcs8 -topk8 -nocrypt -in key.pem.
- The curve must match the algorithm: ES256 uses P-256, ES384 uses P-384 and ES512 uses P-521 (not P-512). A mismatched key is rejected with a clear message.
- Verification checks the signature only. It does not check exp, nbf, aud or iss, so an expired token can still show as valid. Check the claims with the JWT parser.
- For verification you can paste a public key (-----BEGIN PUBLIC KEY-----); a PKCS#8 private key also works, because the public part is derived from it.
- Use test keys only. Do not paste a production private key or secret into any web page, even one that runs locally.
Frequently asked questions
- What is the difference between HS256 and RS256?
- HS256 uses one shared secret for both signing and verifying, so every party that can verify can also forge tokens. RS256 signs with a private key and verifies with a public key, which lets you share verification without sharing the ability to sign.
- Why does verification say the signature is invalid?
- The most common causes are a different secret or key, a secret decoded with the wrong encoding (UTF-8 text versus base64url), a token whose header names another algorithm than the one you expect, or a token that was edited after signing.