WebCrypto Verify

JWT Signature Verifier & Claim Validator

Verify HS256, HS384, HS512, RS256, PS256, and ES256 JSON Web Token signatures plus exp and nbf timestamps directly in your browser using the W3C WebCrypto API. Every check runs locally in client memory so neither your tokens nor your keys ever leave your device.

How It Works

A compact JSON Web Signature token joins three Base64URL segments with periods: the JOSE header, the JSON payload, and the cryptographic signature calculated over the ASCII bytes of header.payload. Unlike simple token decoding, signature verification recomputes or validates that mathematical proof using the W3C WebCrypto crypto.subtle engine inside your browser memory without uploading secrets across the network.

For symmetric HMAC algorithms (HS256, HS384, HS512), WebCrypto imports raw secret bytes in text, hexadecimal, Base64, or Base64URL form and verifies the MAC tag while flagging secrets shorter than the RFC 7518 Section 3.2 hash-length floor. For asymmetric keys, it imports SPKI PEM certificates or JWK/JWKS public keys for RSASSA-PKCS1-v1_5, RSA-PSS, or raw IEEE P1363 r||s ECDSA signatures (ES256, ES384, ES512), automatically rejecting unsecured alg: "none" tokens and noting when EdDSA or ES256K sit outside standard WebCrypto.

Step-by-Step Guide & Real Example

Follow these four steps to confirm both mathematical signature authenticity and temporal claim validity on any JWT in your browser.

1. Paste your compact three-part JWT

Insert the header.payload.signature string into the token field or load an official RFC 7515 Appendix A vector to benchmark behavior immediately.

2. Pin or review the expected algorithm

Leave auto-detect on for quick local debugging, or pick an explicit algorithm such as RS256 or ES256 to simulate server-side algorithm allowlisting.

3. Supply the HMAC secret or public key

For HS256/384/512, select UTF-8, hex, Base64, or Base64URL encoding matching your secret manager. For RS/PS/ES tokens, paste a PEM SPKI public key, single JWK, or public JWKS.

4. Inspect signature status and exp/nbf leeway

Adjust clock-skew leeway in seconds if microservices drift slightly, then review signature validity alongside individual exp, nbf, and iat status badges.

Worked Example: RFC 7515 Appendix A.1 (HS256)

Token & Base64URL JWK Secret k:Token: eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFtcGxlLmNvbS9pc19yb290Ijp0cnVlfQ.dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk | Secret (base64url): AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow
Observed Verification Output:Signature VALID (HS256, 32-byte tag, 512-bit key) · exp=1300819380 (2011-03-22T18:43:00Z, Expired) · claims iss="joe", is_root=true.

Notice how cryptographic signature verification succeeds independently of claim expiration: this exact distinction prevents debugging confusion when testing archived fixtures.

Common Mistakes & Security Notes

Trusting the token header "alg" blindly on servers

An attacker can swap RS256 to HS256 and sign using your publicly distributed PEM key. Servers must enforce an explicit algorithm allowlist independent of the token header.

Accepting unsecured alg: "none" tokens

Legacy libraries sometimes accept empty signatures when alg equals "none". Always block unsigned tokens across every route; this verifier rejects them automatically.

Using short HMAC secrets below RFC 7518 limits

HS256 requires at least 256 bits (32 random bytes), HS384 needs 384 bits, and HS512 needs 512 bits. Short strings expose tokens to offline dictionary cracking.

Pasting private keys into online verification workflows

Signature verification only ever requires the public SPKI PEM or public JWK. Never paste production private keys into third-party websites or browser extensions you do not audit.

JWT Signature Algorithms Compared

AlgorithmKey TypeSignature FormatBest Use Case
HS256 / HS384 / HS512Symmetric Shared SecretHMAC-SHA Digest (32–64 B)Single trusted backend & internal services
RS256 / RS384 / RS512Asymmetric RSA (PKCS#1 v1.5)Modulus-sized RSA signatureWide legacy compatibility & OIDC JWKS
PS256 / PS384 / PS512Asymmetric RSA-PSSProbabilistic padded signatureModern RSA deployments needing stronger proofs
ES256 / ES384 / ES512Asymmetric ECDSA (P-256..521)Raw IEEE P1363 r||s (64–132 B)Compact tokens for mobile APIs & gateways

Code Snippets (Node.js, Python, Java)

Replicate pinned-algorithm JWT signature verification in backend services with native runtime crypto or standard libraries:

Node.js (TypeScript)
import { createHmac, timingSafeEqual } from 'node:crypto';

export function verifyHs256(token: string, secret: Buffer) {
  if (secret.length < 32) throw new Error('Key < 256 bits');
  const [hdr, pay, sig] = token.split('.');
  const { alg } = JSON.parse(Buffer.from(hdr, 'base64url').toString());
  if (alg !== 'HS256') throw new Error('Invalid alg');
  const expected = createHmac('sha256', secret).update(`${hdr}.${pay}`).digest();
  const actual = Buffer.from(sig, 'base64url');
  if (expected.length !== actual.length || !timingSafeEqual(expected, actual)) throw new Error('Bad signature');
  return JSON.parse(Buffer.from(pay, 'base64url').toString());
}
Python
import jwt

def verify_rs256(token: str, public_pem: str, aud: str) -> dict:
    return jwt.decode(
        token, public_pem, algorithms=["RS256"],
        audience=aud, leeway=30, options={"require": ["exp", "sub"]},
    )
Java
DecodedJWT jwt = JWT.require(Algorithm.ECDSA256(ecPublicKey, null))
    .withIssuer("https://auth.example.com")
    .acceptLeeway(15)
    .build()
    .verify(token);

Frequently Asked Questions

What is the difference between decoding a JWT and verifying its signature?

Decoding simply reverses Base64URL encoding into JSON so anyone can inspect headers and claims. Verification recomputes or mathematically checks the signature against a trusted key to prove the token has not been forged or modified.

Why does the verifier warn about auto-detecting the algorithm from the header?

Auto-detection is convenient for debugging local tokens, but trusting header.alg blindly on a production server enables algorithm-confusion attacks such as coercing an RSA public key to verify an HS256 token.

Why are EdDSA and ES256K marked unsupported in this browser verifier?

This verifier strictly uses native W3C WebCrypto (crypto.subtle) without third-party dependencies. Standard browser WebCrypto implementations do not support secp256k1 (ES256K), and Ed25519/EdDSA browser support varies across runtimes.

What does an expired claim mean if the signature shows valid?

It means the token was genuinely signed with your key and has not been altered since issuance, but its exp timestamp is earlier than the current clock minus configured leeway.

Can I paste a JWKS endpoint JSON document instead of a single public key?

Yes. Paste a standard JWKS object containing a keys array; if your JWT header includes a matching kid field, the verifier automatically selects that key.

Are tokens and secrets ever uploaded or logged when verified here?

No. Every cryptographic check runs synchronously or via crypto.subtle in client browser memory with zero network uploads or persistence.

About the author

Avada Labs builds free developer tools, including this site, with six years of experience in web development and online tools. Projects and source code are on GitHub.

JWT Signature Verifier – HS256, RS256, ES256 Online