# JWT Generator

Create a signed JSON Web Token from your own JSON claims. Choose HS256, HS384 or HS512 with a shared secret, RS256 to PS512 with an RSA private key, ES256 to ES512 with the matching EC key, or EdDSA with an Ed25519 key, given as PEM or JWK. The generator can add iat, exp and a kid header, signs with the jose library and shows the compact token next to its decoded header and payload.

## Frequently asked questions

### Which signing algorithms can I use?

The generator supports HS256, HS384 and HS512 with a shared secret, RS256, RS384, RS512, PS256, PS384 and PS512 with an RSA private key, ES256, ES384 and ES512 with an EC private key on P-256, P-384 or P-521, and EdDSA with an Ed25519 private key. The algorithm you pick is written to the alg header, and typ is always set to JWT.

### What do I enter as the payload?

Enter a JSON object with your claims, for example sub, name, iss, aud or any custom member. Arrays, strings and other values that are not an object are rejected, because a JWT payload must be a JSON object. Claim order and values are kept exactly as you wrote them.

### How is the HMAC secret read?

For HS256, HS384 and HS512 the secret is used as UTF-8 text after leading and trailing whitespace is removed. If your secret is binary, paste it as a JWK such as {"kty": "oct", "k": "..."} with the bytes in base64url, and the decoded bytes are used instead. PEM keys are refused for HMAC algorithms, because using a public key as an HMAC secret is a classic mistake.

### How long should an HS256 secret be?

RFC 7518 asks for a key at least as long as the hash output, so 32 bytes for HS256, 48 for HS384 and 64 for HS512. The tool signs with shorter secrets so you can reproduce test tokens, but production secrets should be long random values, for example from the Password Generator.

### Which private key formats are accepted for RSA, EC and EdDSA?

Paste an unencrypted PEM private key in PKCS #8 (BEGIN PRIVATE KEY), PKCS #1 (BEGIN RSA PRIVATE KEY) or SEC1 (BEGIN EC PRIVATE KEY) form, or a private JWK that contains its d member. Encrypted PEM files and OpenSSH private keys are not read. The key has to fit the algorithm, so ES384 needs a P-384 key and RSA keys need at least 2048 bits.

### How do iat and exp get set?

When the issued at option is on, iat is set to the current time unless your payload already has an iat claim. When the expiry is above 0 seconds, exp is set to the current time plus that many seconds and replaces any exp in your payload. With an expiry of 0 no exp is added and an exp from your payload is kept.

### What is the kid field for?

A non-empty key ID is written to the kid header so verifiers can pick the right key from a JWKS. If you paste a JWKS as the signing key, the kid also selects which key in the set signs the token. The JWK Converter and the key generators show the RFC 7638 thumbprint, which makes a good kid.

### What does the result contain?

You get the compact token, the algorithm, the key ID, the issued at and expiry times in UTC, and the exact header and payload JSON that were signed. Copy the token from the first block. Decode it again later with the JWT Decoder or check it with the JWT Verifier.

### Are my secrets or keys stored?

No. The secret or private key travels only in the request that signs the token, is used once in memory and is never logged or saved. Even so, prefer test keys for experiments and never paste a production signing key into any web tool unless you control the server.

### Are there size limits?

The payload may be up to 65,536 characters and the key up to 65,536 characters, and the kid up to 256 characters. Expiry values range from 0 to 315,360,000 seconds, which is ten years. Longer inputs are rejected with a message that names the field.

Your ad here?

[Email us](mailto:hi@dennn.is?subject=Advertising%20on%20OneClick%20Pro)

[Ad The agent-ready plugin suite for WordPress.](https://sleekwp.com/?ref=oneclickpro)
