jsonwebtoken vs jose
jsonwebtoken vs jose compared for 2026: Auth0's Node-only JWT library (9.0.3) vs panva's zero-dependency JOSE suite (6.2.19) that runs in browsers, edge runtimes, Deno and Bun. Includes sign and verify timings, bundle sizes, security-default and TypeScript tests we ran on 4 December 2026.
Quick Answer
Pick jose for new code and keep jsonwebtoken only in existing Node.js services that work. jose 6.2.19 (30 November 2026) has zero dependencies, runs on Web Crypto in browsers, Cloudflare Workers, Deno, Bun and Node.js, and covers the whole JOSE family: JWS, JWE, JWK, JWKS fetching and EdDSA. jsonwebtoken 9.0.3 (4 December 2025, a dependency bump) signs and verifies JWS tokens in Node.js only: it pulls 15 packages, failed to bundle for the browser (Node built-ins such as stream and crypto) and rejected EdDSA. On safety defaults the two behaved the same in our tests: both refused alg none tokens, RSA public keys used as HMAC secrets and 1024-bit RSA keys, and both accepted a 3-byte HMAC secret. jsonwebtoken was faster on one core (HS256 sign 210-221 ms per 10,000 against 273-300 ms; RS256 verify 274-322 against 393-394 ms), but both handled tens of thousands of HMAC operations per second. With @types/jsonwebtoken, TypeScript caught an algorithm typo and a bad expiresIn that jose only reports at runtime.
Last updated December 4, 2026. Covers jsonwebtoken 9.0.3 (4 December 2025) with @types/jsonwebtoken 9.0.10 and jwks-rsa 4.1.0, and jose 6.2.19 (30 November 2026); npm registry metadata and download counts, GitHub repositories and release notes, both READMEs and the jsonwebtoken CHANGELOG read on 4 December 2026, plus speed, bundle, security-default and TypeScript tests we ran that day.
| Feature | jsonwebtoken | jose |
|---|---|---|
| Licence & Repository | MIT; auth0/node-jsonwebtoken, ~18.2k stars, 220 open issues and PRs | MIT; panva/jose, ~7.9k stars, 0 open issues |
| Latest Release | 9.0.3 on 4 Dec 2025 (jws 4.0.1 update) | 6.2.19 on 30 Nov 2026 |
| npm Weekly Downloads (27 Nov-3 Dec 2026) | 68,928,992 | 198,761,647 |
| Our Run: Install (packages / size) | 15 packages, 824 KB | 1 package, 544 KB |
| Runtimes | Node.js (engines >= 12) | Node.js, browsers, Cloudflare Workers, Deno, Bun, Electron |
| Our Run: Browser Bundle (sign + verify, min / gzip) | Failed: Could not resolve stream, crypto, buffer, util | 17,624 B / 6,432 B |
| Our Run: Node Bundle (sign + verify, min / gzip) | 59,765 B / 19,393 B | 17,624 B / 6,429 B |
| API Style | sign / verify / decode; sync, or callback | Promise-based builders: SignJWT, jwtVerify, EncryptJWT, jwtDecrypt |
| Signing Algorithms | HS*, RS*, PS*, ES* (256/384/512) and none | HS*, RS*, PS*, ES*, EdDSA, Ed25519, ML-DSA (runtime-dependent); no none in jwtVerify |
| Our Run: Ed25519 Signing | Rejected: "algorithm" must be a valid string enum value | Signed with alg EdDSA and Ed25519 |
| Encryption (JWE) | ||
| Remote JWKS | Via jwks-rsa 4.1.0 (1 HTTP request for 20 verifies in our run) | createRemoteJWKSet built in (1 HTTP request for 20 verifies) |
| Our Run: alg none Token | Rejected: jwt signature is required (even with algorithms: ['none']) | Rejected: alg none is not supported (UnsecuredJWT is a separate, explicit API) |
| Our Run: RSA Public Key as HMAC Secret | Rejected: invalid algorithm / must be a symmetric key | Rejected: KeyObject must be of type secret for HS256 |
| Our Run: Weak Keys | RSA-1024 rejected; 3-byte HMAC secret accepted | RSA-1024 rejected; 3-byte HMAC secret accepted |
| Our Run: HS256 Sign x10,000 (1 core) | 210-221 ms | 273-300 ms |
| Our Run: RS256 Verify x10,000 (1 core) | 274-322 ms (KeyObject); 426-435 ms (PEM string) | 393-394 ms (KeyObject); 364-400 ms (imported CryptoKey) |
| Our Run: ES256 Verify x10,000 (1 core) | 758-778 ms | 876-886 ms |
| Our Run: TypeScript Mistakes Caught | 3 of 3 (with @types/jsonwebtoken 9.0.10) | 2 of 4 (built-in types; alg typo and time string not caught) |
| Release Activity | 9.0.1 Jul 2023, 9.0.2 Aug 2023, 9.0.3 Dec 2025 | 6.2.14-6.2.19 between 29 Oct and 30 Nov 2026 |
jsonwebtoken
jsonwebtoken is Auth0's JSON Web Token library for Node.js. It has three functions: sign(), verify() and decode(). sign() and verify() are synchronous unless you pass a callback, and verify() can take a callback that looks up the key from the token header, which is how it pairs with the separate jwks-rsa package for identity providers. It implements JWS signing only: HS256/384/512, RS256/384/512, PS256/384/512, ES256/384/512 and none, built on the jws and jwa packages and Node's crypto module. Options cover expiresIn and notBefore as vercel/ms strings, audience, issuer, subject, jwtid, maxAge, clockTolerance and an algorithms allow-list. Version 9.0.0 (21 December 2022) was a security release: it fixed CVE-2022-23529, CVE-2022-23539, CVE-2022-23540 and CVE-2022-23541, stopped accepting unsigned tokens by default, required RSA keys of 2048 bits or more and checked that key types match the algorithm. Since then there have been three releases: 9.0.1 (July 2023), 9.0.2 (August 2023, semver bump for CVE-2022-25883) and 9.0.3 (4 December 2025, jws 4.0.1). It is CommonJS, needs @types/jsonwebtoken for TypeScript and depends on Node built-ins, so it does not run in browsers or edge runtimes without polyfills.
Pros
- Simplest API: synchronous sign() and verify() returning a string or the payload
- Fastest of the two in our single-core runs for HS256 sign (210-221 ms per 10,000) and RS256 verify (274-322 ms)
- Safe defaults since 9.0: refused alg none, an RSA public key as HMAC secret and a 1024-bit RSA key
- @types/jsonwebtoken caught an algorithm typo, an un-narrowed payload and a bad expiresIn at compile time
- Huge installed base: 68.9 million downloads in the week to 3 December 2026 and countless examples
Cons
- Node.js only: our browser bundle failed on stream, crypto, buffer and util imports
- No EdDSA: signing with an Ed25519 key failed with an algorithm enum error
- No JWE, JWK import or JWKS fetching; remote keys need jwks-rsa (a separate package)
- 15 packages and 824 KB installed, 59,765 B minified for sign + verify
- Slow release cadence: one release since August 2023, 220 open issues and PRs
Best For
Existing Node.js services that already sign and verify HS256 or RS256 tokens with it, simple server-only setups where a synchronous API and familiar examples matter more than portability.
jose
jose is panva's JavaScript implementation of JSON Object Signing and Encryption: JWT, JWS, JWE, JWK, JWKS and more, with zero dependencies and tree-shakeable ESM. It is built on the Web Crypto API and runs in Node.js, browsers, Cloudflare Workers, Deno, Bun and Electron, with algorithm availability depending on the runtime. The API is promise-based and builder-style: new SignJWT(payload).setProtectedHeader({ alg }).setExpirationTime('2h').sign(key) to sign, jwtVerify(token, key, options) to verify, and EncryptJWT / jwtDecrypt for encrypted tokens. createRemoteJWKSet() fetches and caches an identity provider's key set and picks the key by kid. It implements RFC 7515-7520, 7638, 7797, 8037, RFC 9864 fully-specified algorithms (such as Ed25519) and ML-DSA (RFC 9964). The v6 line started on 22 February 2025 and is the only supported major; in Node.js you can require() it where require(esm) is enabled by default (^20.19.0, ^22.12.0 or 23+). Releases are frequent: 6.2.14 to 6.2.19 shipped between 29 October and 30 November 2026, the last rejecting boxed audience options. It is downloaded roughly three times as often as jsonwebtoken.
Pros
- Built on Web Crypto: sign + verify bundled for browser and Node targets alike at 17,624 B (6,429 B gzip)
- Zero dependencies: 1 package, 544 KB installed
- Full JOSE: JWE encryption, JWK import/export, EdDSA and Ed25519, ML-DSA
- Built-in createRemoteJWKSet with caching (1 HTTP request for 20 verifies in our run)
- Strict parsing: decodeJwt() threw JWTInvalid on garbage where jsonwebtoken.decode() returned null
- Active: six releases in the five weeks to 30 November 2026, 0 open issues
Cons
- Promise-only API and a builder style that is more verbose for simple HS256 tokens
- Slower than jsonwebtoken in our Node runs: HS256 sign 273-300 ms and RS256 verify 393-394 ms per 10,000
- An algorithm typo or bad time string ('1 hour please') compiled fine and failed only at runtime
- ESM-first: require() needs Node.js ^20.19, ^22.12 or 23+
- Accepted a 3-byte HMAC secret, so secret strength is still your job
Best For
New projects, anything running on edge runtimes, Deno, Bun or in the browser, services that verify tokens from an identity provider via JWKS, and apps that need encrypted tokens, EdDSA or JWK handling.
Two libraries, two scopes
jsonwebtoken does one job: it creates and checks signed JWTs in Node.js. jose implements the whole JOSE family of specifications, of which signed JWTs are one part. That difference shows up as soon as you leave the basic case. Verifying tokens from Auth0, Okta, Cognito or any OpenID Connect provider means fetching their JWKS and picking the key by kid; jose has createRemoteJWKSet() built in, while jsonwebtoken needs jwks-rsa and a key-lookup callback. Encrypted tokens (JWE), importing or exporting JWKs, EdDSA with Ed25519 keys and post-quantum ML-DSA are all jose-only; jsonwebtoken's algorithm list stops at HMAC, RSA, RSA-PSS and ECDSA, and it rejected an Ed25519 key in our test with an algorithm enum error. The other big difference is runtime. jsonwebtoken is CommonJS and leans on Node's crypto, stream, buffer and util modules through jws and jwa, so esbuild could not bundle it for the browser. jose uses Web Crypto and fetch, which is why its README lists browsers, Cloudflare Workers, Deno, Bun and Electron alongside Node.js. If any part of your stack verifies tokens at the edge or in middleware, jose is the one that runs there. Our How JWTs Work guide, JWT Decoder tool and JWT glossary entry cover the token format itself.
What we measured: speed, size and installs
On 4 December 2026 we installed jsonwebtoken 9.0.3 and jose 6.2.19 on Node.js 22.23.5 in a 2-vCPU sandbox and timed 10,000 operations on one core, three runs each. HS256 signing took 210-221 ms with jsonwebtoken and 273-300 ms with jose; HS256 verification was close, 235-279 ms against 249-285 ms. RS256 signing (2,000 operations) took 600-617 ms against 639-762 ms, because the RSA private-key operation dominates. RS256 verification took 274-322 ms with jsonwebtoken given a KeyObject and 393-394 ms with jose; passing jsonwebtoken a PEM string instead slowed it to 426-435 ms, so convert keys once with crypto.createPublicKey(). ES256 verification took 758-778 ms against 876-886 ms. In other words jsonwebtoken was 10-30% faster here, and both verified tens of thousands of HMAC tokens per second per core, far more than most APIs need. For reference, fast-jwt 6.3.7 verified HS256 in 64-75 ms with default options. Sizes favour jose clearly: 1 package and 544 KB installed against 15 packages and 824 KB, and a minified sign + verify bundle of 17,624 B (6,429 B gzip) against 59,765 B (19,393 B). Adding createRemoteJWKSet only grew jose's bundle to 18,615 B. Load time was a wash at 17-22 ms for each.
Security defaults we tested
Many well-known JWT bugs come from verifiers that trust the token header. We forged tokens to check. An unsigned alg none token was rejected by jsonwebtoken (jwt signature is required, even when we put none in the algorithms list) and by jose (alg none is not supported); jose only decodes such tokens through its separate UnsecuredJWT API. A token signed with HS256 using the server's RSA public key as the HMAC secret, the classic key-confusion attack, was rejected by both: jsonwebtoken with invalid algorithm, or must be a symmetric key when we allowed HS256, and jose with a key-type error. Both refused to sign with a 1024-bit RSA key. Expired tokens failed in both and passed with a 30-second clockTolerance. Both rejected a mismatched audience. The gaps were shared too: a token with no exp claim and an iat two hours old verified in both unless we set maxAge (jsonwebtoken) or maxTokenAge (jose), and both happily signed HS256 with the 3-byte secret abc. jsonwebtoken's 9.0.0 release fixed four CVEs in exactly this area, so make sure nothing in your lockfile still resolves 8.x. Behaviour differences are small but real: jsonwebtoken.decode() returned null for garbage input while jose.decodeJwt() threw, and jsonwebtoken signs plain string payloads, which jose does not.
TypeScript, modules and developer experience
jsonwebtoken's API is the shorter one: jwt.sign(payload, secret, { expiresIn: '1h' }) returns a string synchronously and jwt.verify() returns the payload or throws. jose's builder takes more lines and every call returns a promise: new SignJWT(payload).setProtectedHeader({ alg: 'HS256' }).setExpirationTime('1h').sign(key), with the HMAC secret passed as a Uint8Array. Error handling differs as well: jsonwebtoken throws TokenExpiredError or JsonWebTokenError, jose throws classes such as JWTExpired with codes like ERR_JWT_EXPIRED. For TypeScript we planted mistakes and ran tsc 6.0.3 in strict mode. @types/jsonwebtoken 9.0.10 caught all three planted in jsonwebtoken code: an algorithm typo (HS265), reading payload.role without narrowing string | JwtPayload, and expiresIn: '1 hour please'. jose's bundled types caught two of four: payload.role typed unknown, and a wrong type on a generic jwtVerify<{ role: string }> payload. The alg typo and the bad time string compiled and only failed at runtime (JOSENotSupported and TypeError: Invalid time period format). On modules, jose is ESM; require('jose') worked on Node.js 22.23.5, and its README gives ^20.19.0, ^22.12.0 or 23+ as the versions with require(esm) on by default. jsonwebtoken is CommonJS and imports fine from ESM.
Maintenance, migration and when to keep jsonwebtoken
Release history is the clearest difference. jsonwebtoken has shipped three releases since the December 2022 security release: 9.0.1 and 9.0.2 in 2023 and 9.0.3 on 4 December 2025, which only updated jws to 4.0.1. Its repository had 220 open issues and pull requests and a last push on 25 June 2026. jose shipped 6.2.14 through 6.2.19 between 29 October and 30 November 2026, had no open issues and was pushed to on 3 December 2026. A quiet library is not automatically a risky one, and jsonwebtoken's 9.x defaults held up in every check we ran, but new standards such as EdDSA and RFC 9864 algorithms will not appear there. Migration is mechanical. Replace jwt.sign() with SignJWT and set alg explicitly; replace jwt.verify(token, secret, { algorithms, audience, issuer }) with await jwtVerify(token, key, { algorithms, audience, issuer }) and read .payload; encode string secrets with TextEncoder; swap jwks-rsa callbacks for createRemoteJWKSet(new URL(jwksUri)); and map error classes by code. Because verify becomes async, Express middleware needs an async handler. Keep jsonwebtoken if your service is Node-only, uses HS256 or RS256, and the migration buys you nothing this quarter. For broader auth decisions, see our Clerk vs Auth0 and Better Auth vs Clerk comparisons.
Verdict
Pick jose for anything new. It runs unchanged in Node.js, browsers, Cloudflare Workers, Deno and Bun, has no dependencies, verifies identity-provider tokens with a built-in cached JWKS client, and covers JWE, JWK and EdDSA that jsonwebtoken does not. Its sign + verify bundle was about a third the size of jsonwebtoken's, and it ships releases every week or two. Keep jsonwebtoken in existing Node.js services that only sign and verify HS256 or RS256 tokens: it is on 9.x with safe defaults, it behaved the same as jose in our none, key-confusion and weak-RSA tests, it was faster on one core, and @types/jsonwebtoken catches more mistakes at compile time. There is no security reason to rip it out today, but there is little reason to start with it either, given one release since 2023 and no EdDSA, JWE or edge support. Whichever you use, always pass an algorithms allow-list, check audience and issuer, set maxAge or maxTokenAge for tokens without exp, and generate HMAC secrets with enough entropy, because both libraries accepted a 3-byte secret.


