JWT Token Generator

Signs a JSON object as a JSON Web Token using a provided secret / private key.

Input: Structured JSONResult: Text

Text input

Run to see the result

Examples

Example keys and passwords are public test material.

Sign a public read-only demo token

A fixed public demo token with an independent Node HMAC-SHA256 expected signature. It grants no access to any service.

Input

{"sub":"demo-user","iat":1735689600,"scope":"read:examples"}

Expected answer

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkZW1vLXVzZXIiLCJpYXQiOjE3MzU2ODk2MDAsInNjb3BlIjoicmVhZDpleGFtcGxlcyJ9.dw9n3PRe1qXd5LpTtuoomm8HVs8a6-8U_eAXbeCd_bU
Private/Secret Key
public-example-key
Signing algorithm
HS256
Header
{}
HS256

Input

{
    "String": "SomeString",
    "Number": 42,
    "iat": 1
}

Expected answer

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.0ha6-j4FwvEIKPVZ-hf3S_R9Hy_UtXzq4dnedXcUrXk
Private/Secret Key
secret_cat
Signing algorithm
HS256
Header
{}
HS256 with custom header

Input

{
    "String": "SomeString",
    "Number": 42,
    "iat": 1
}

Expected answer

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImN1c3RvbS5rZXkifQ.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.kXln8btJburfRlND8IDZAQ8NZGFFZhvHyooHa6N9za8
Private/Secret Key
secret_cat
Signing algorithm
HS256
Header
{"kid":"custom.key"}
HS384

Input

{
    "String": "SomeString",
    "Number": 42,
    "iat": 1
}

Expected answer

eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ._bPK-Y3mIACConbJqkGFMQ_L3vbxgKXy9gSxtL9hA5XTganozTSXxD0vX0N1yT5s
Private/Secret Key
secret_cat
Signing algorithm
HS384
Header
{}
HS512

Input

{
    "String": "SomeString",
    "Number": 42,
    "iat": 1
}

Expected answer

eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJTdHJpbmciOiJTb21lU3RyaW5nIiwiTnVtYmVyIjo0MiwiaWF0IjoxfQ.vZIJU4XYMFt3FLE1V_RZOxEetmV4RvxtPZQGzJthK_d47pjwlEb6pQE23YxHFmOj8H5RLEdqqLPw4jNsOyHRzA
Private/Secret Key
secret_cat
Signing algorithm
HS512
Header
{}

The key should be either the secret for HMAC algorithms or the PEM-encoded private key for RSA and ECDSA.

Format reference: JWT Sign background and specification

Related tools

Browse encryption / encoding tools