JWT Encoder
Create a signed JSON Web Token from a JSON payload using HS256, HS384 or HS512.
What is the JWT Encoder?
Signing a JWT lets a server verify later that the claims were not altered.
How does it work?
The header and payload are serialised, Base64URL-encoded and joined with a dot. An HMAC of that string with your secret becomes the signature.
Formula
signature = HMAC-SHA256(secret, base64url(header) + "." + base64url(payload))
Example
A payload with sub, role, iat and exp signed with HS256 produces a three-part token you can test in the JWT Decoder.
Frequently asked questions
Is my data sent to a server?
No. This tool runs entirely in your browser; nothing you paste is uploaded or stored.
Why not RS256?
RS256 needs a private key. Asymmetric signing is best done on your server; this tool focuses on HMAC for testing.
Related tools
Enable JavaScript to use this calculator.