# JWT decoder

Decode the header and payload of a JSON Web Token and show its times, without verifying it.

- Endpoint: `POST https://setget.net/v1/tools/jwt-decode` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `jwt-decode`
- Page: https://setget.net/tools/jwt-decode

## Inputs

- `token` (required, string): The JWT to decode. Use a test or expired token, never a live one.
- `now` (optional, string): The time to compare "exp" and "nbf" against, as an ISO 8601 time. Adds the "expired" flag. Left out, no comparison is made.

## Example 1

```json
{"input":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"}}
```

Result:

```json
{"header":{"alg":"HS256","typ":"JWT"},"payload":{"sub":"1234567890","name":"John Doe","iat":1516239022},"signature":"SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c","algorithm":"HS256","times":{"iat":"2018-01-18T01:30:22Z"},"verified":false}
```

## Example 2: Checking expiry against a given time

```json
{"input":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI0MiIsIm5iZiI6MTY5OTk5NjQwMCwiZXhwIjoxNzAwMDAwMDAwfQ.c2lnbmF0dXJl","now":"2024-01-01T00:00:00Z"}}
```

Result:

```json
{"header":{"alg":"HS256","typ":"JWT"},"payload":{"sub":"42","nbf":1699996400,"exp":1700000000},"signature":"c2lnbmF0dXJl","algorithm":"HS256","times":{"exp":"2023-11-14T22:13:20Z","nbf":"2023-11-14T21:13:20Z"},"verified":false,"now":"2024-01-01T00:00:00Z","expired":true,"not_yet_valid":false}
```

**Does this verify the signature?** No. It only decodes. A decoded token proves nothing about who made it, so never trust its contents without verifying the signature in your own code.

**Is it safe to paste a live token?** No. A valid token works like a password until it expires. Never paste live tokens into any online tool; use an expired or test token.

**Is the payload encrypted?** No. The header and payload of a signed JWT are only base64url-encoded, so anyone holding the token can read them.

**Why is there no "expired" flag?** The tool never reads the clock. Send the current time as "now" to have "exp" and "nbf" compared against it.
