How to Generate JWT Tokens for Testing
JWT Generation
When to Generate JWTs
Generate signed JWTs when building test fixtures, prototyping API clients, or debugging authorization flows — without setting up a token issuer. Paste a JSON payload object, choose an HMAC algorithm, and provide a signing secret. The header (alg, typ) is added automatically.
Supported Algorithms
This tool signs tokens with HMAC algorithms (HS256, HS384, HS512). RS256 signing requires a private key and is not supported in-browser. The output is a complete three-part JWT ready for Authorization headers.
Common Mistakes
- Using production secrets in client-side code — this tool is for local testing only
- Forgetting
exp— tokens without expiration never expire in tests either - Invalid JSON in header or payload — both must parse before signing
Security Note
Never embed signing secrets in production client-side code. Use this tool only for local development and testing. Inspect generated tokens with the JWT Signature Checker before relying on them in integration tests.
Frequently asked questions
Does this add an iat claim automatically?
Yes. If your payload does not include iat, the tool adds the current Unix timestamp.
Can I generate RS256 tokens?
Not currently. Use HS256/384/512 for HMAC-signed test tokens, or sign RS256 tokens with your backend.
Is my secret sent to a server?
No. Signing runs entirely in your browser using the Web Crypto API.