Skip to content
BetterPass logo
Internal testing

JWT HS256 vs PASETO v4.local — Token Comparison Playground

Side-by-side: the same payload signed as JWT HS256 and encrypted as PASETO v4.local, using the same key — all in your browser.

The same key signs the JWT and encrypts the PASETO token.
JWT has no footer field — shows the format asymmetry.

What is the Token Comparison Playground?

When teams debate tokens, it is usually framed as "JWT versus PASETO" as if each were a single thing. In practice each format has two very different flavors, and mixing them up is where teams get burned.

JWT HS256 — a *signed* token: it proves authenticity and integrity, but its payload is readable by anyone who holds it.
PASETO v4.local — an *encrypted* token: the same claims are sealed with XChaCha20-Poly1305 so only someone with the key can read them.
Same input, honest comparison — feed in one JSON payload and one 32-byte key, and this playground produces both tokens from the very same input.

This playground gets that distinction out of the abstract and onto the screen. You can see, not just read about, the three-part JWT with its negotiated `alg` header, and the versioned PASETO with its fixed algorithm, nonce, and authentication tag — and you can watch the byte sizes and timing sit side by side in real time.

Zero-Server Tool Data Guarantee

All comparison generation, JWT signing, PASETO encryption, and decryption happen entirely in your browser using the Web Crypto API and tweetnacl. Tokens, secrets, and keys never leave your device.

How to Use

01

Enter a JSON payload

Type or paste any JSON object, or load a ready-made template (basic, claims, or OIDC) to seed common claim shapes.

02

Set the shared key

Enter a 32-byte key as base64url, or click Random to generate one. The same key signs the JWT and encrypts the PASETO token.

03

Optionally add a PASETO footer

Add a footer such as a kid for key identification. JWT has no footer, which visually highlights the format difference.

04

Generate both tokens

Click Generate to produce the JWT HS256 and PASETO v4.local tokens from the same payload and key, with byte sizes and per-format timing.

05

Verify the round-trip

The tool checks the JWT signature and decrypts the PASETO token to confirm both recover the exact original payload.

JWT HS256 vs PASETO v4.local

PropertyJWT HS256PASETO v4.local
Structureheader.payload.signaturev4.local.nonce+ciphertext[.footer]
PrimitiveHMAC-SHA256XChaCha20-Poly1305 (AEAD)
Payload visibilityReadable (Base64URL only)Encrypted
Algorithm negotiationHeader alg (agility risk)Fixed per version
Key IDkid in headerkid in authenticated footer
Typical overhead~3 Base64URL segments+24-byte nonce, +16-byte tag

Production Best Practices & Security

Signed does not mean secret. A verified JWT HS256 proves it wasn't tampered with; it does not keep its claims private.
Encryption and signature are different guarantees. v4.local gives you confidentiality *and* authentication in one primitive; HS256 gives you authenticity only.
Size is a wash. For a real claim set both tokens land within a few dozen bytes of each other — pick based on requirements, not bytes.
Match the format to the data. Put sensitive claims in v4.local; keep lightweight, non-sensitive identity claims in an HS256 JWT.
Never share a long-lived symmetric key. Whether HMAC or v4.local, rotate the key and store it in a KMS or secrets manager, never in source.

Frequently Asked Questions

JWT HS256 is a signed, self-contained token: header.payload.signature, where the signature is an HMAC-SHA256 over those first two parts using a shared secret. Anyone who holds the token can read the payload — it is only Base64URL-encoded, never encrypted.

PASETO v4.local is an encrypted token: v4.local.nonce+ciphertext[.footer]. The payload is sealed with XChaCha20-Poly1305, so it is both confidential and authenticated. There is no header, and the cryptographic algorithm is fixed by the version rather than declared in the token.

That one design choice — signing vs. authenticated encryption — is the core difference this playground lets you feel side by side.