How to decode a JWT and inspect its header and claims

Read a JWT’s header and payload in TinyToolbox, inspect timestamps and audiences, and make a signed fixture for a local test.

Open the tool

When a local application rejects a token, you may need to find out what the token says before you can understand why the application rejected it. The token might name an older test service as its audience, or its expiration time may have passed. A decoded view helps you inspect those values. The application still needs to validate the token before using its claims to make a decision.

TinyToolbox JWT Encoder and Decoder displays the header and payload of a three-part compact JWT. It also offers an HS256 signing mode for use with your own test secret. Work with a synthetic fixture when possible. A real token can contain private information, and a live bearer token may grant access to the service it was issued for.

Identify the compact token

The tool expects a compact token made of three segments separated by periods. The first segment encodes the header, the second encodes the payload, and the third is the signature segment. The form expects just the token. If you copied an authorization header from a controlled local test, remove the header name and the Bearer prefix before pasting. If the token came from a JSON response, copy the string value without its surrounding JSON quotation marks.

Check for cut-off text. Logs sometimes abbreviate long values or mask them with asterisks. An abbreviated token can fail to decode or omit an entire segment. Use the complete synthetic token from the test fixture. If the destination uses an opaque token or an encrypted token with a different structure, this decoder may be the wrong way to inspect it. Consult the application’s documentation and use diagnostic tools supported by the issuer.

If you want to see how an individual header or payload segment is encoded, Base64 Encoder and Decoder can decode a URL-safe Base64 text value. The JWT tool handles the split for you, parses both parts as JSON, and presents them together.

Decode the token in TinyToolbox

  1. Open JWT Encoder and Decoder.
  2. Paste the compact token into JWT or JSON payload.
  3. Choose Decode token under Operation.
  4. Leave Signing secret (for encoding only) empty.
  5. Select Run tool and inspect Result.

The browser parses the header and payload and displays them under their respective names. It also outputs signatureVerified: false. This is a report of the tool’s behavior. It has not verified the signature, so the value appears even when the token was generated with a valid signature for your own test key. A successful decode also says nothing about the validity of the signature segment itself.

Keep the decoded result out of shared issues if it contains someone’s identifier, an internal service name, or a value copied from a real account. For a debugging example, use made-up data that preserves the relevant shape. A test fixture can demonstrate that an audience is an array or that a timestamp is in seconds without disclosing actual identities or credentials.

Read the header as a description supplied by the token

Look at alg in the header to see the algorithm the token declares. You may also see typ or a kid value that identifies a key according to the issuer’s conventions. These are readable properties from the token. Compare them with what your local application is configured to expect when a test fails.

For example, if a fixture is meant to test HS256 and the header declares a different algorithm, go back to the fixture generator and check its settings. If a key identifier refers to an old test key, confirm that the verifier is using the key intended for the test. The decoder cannot choose the correct key for the receiver or decide whether a declared algorithm is acceptable.

Within your application, the trusted configuration determines which algorithms and sources of keys are accepted. The readable header is useful for narrowing down an error, but the receiver’s verification and validation are what establish whether the application can use the token.

Read claims in the context of your application

The payload contains the values commonly called claims. Applications use a mixture of registered names and their own names. Some you may encounter in a local test include:

Claim What to compare
iss The issuer value configured for the environment you are testing
sub The subject identifier expected in that fixture
aud The intended receiving service or set of services
exp The expiration time
nbf The earliest time the token may be accepted
iat When the token says it was issued

Compare the full string when checking an issuer or audience. Two identifiers that look similar may differ by a trailing slash, port, or path. Audience can also be represented as a string or an array of strings. Review the application’s own checks and compare the decoded value with a fixture that is known to work. A difference can explain a failed test, while a matching value by itself cannot prove the token is accepted.

Time claims such as exp use seconds since the Unix epoch. A common mistake in test data is supplying the millisecond value from a clock function where seconds are expected. Look at the number’s scale and interpret it with the same units used by the receiving application. Check the test clock and the intended relationship between iat, nbf, and exp. If you use a fixed clock in a test, an apparent mismatch against your laptop’s current date may be expected.

The tool displays the claims that are present. It does not add missing claims or check a schema. If a test expects a particular claim to be required, write that expectation into the application’s validation tests and confirm what happens when the claim is omitted.

Create a synthetic HS256 fixture for a local test

Start with a JSON object containing invented values. The following object names a dummy subject and audience for a test harness you control:

{
  "sub": "example-test-user",
  "aud": "local-example",
  "purpose": "decode-demo"
}

Paste it into JWT or JSON payload and select Encode and sign HS256. Enter a dedicated test secret in Signing secret (for encoding only). The tool requires at least 32 UTF-8 bytes. Use a separate test key from your local environment, keep it out of shared examples, and leave any production key out of this workflow. Select Run tool and copy the resulting compact token.

The tool creates a header with alg set to HS256 and typ set to JWT. It signs the header and payload with the provided secret. The claims come from your input object. The form does not generate timestamps, an issuer, or additional values. If your local verifier requires them, construct the fixture using its expected values and test clock, then generate a new token.

Decode the result to confirm that the header and payload contain the names, types, and values you intended. Then pass the token to the test verifier you control. A useful test checks the application’s response against a known expectation. For example, a fixture with the wrong test audience should trigger the audience check. Seeing the claim in this decoder is an inspection step before that application test.

Troubleshoot a local test without confusing decoding and validation

If the decode fails before it displays JSON, first check that you pasted three compact segments and removed surrounding text. Next, confirm that the first two segments contain Base64URL-encoded UTF-8 JSON. If you generated the input in the sign mode and it reports that the payload is invalid, check that the input starts with an object and that its keys use straight double quotes. JSON Formatter & Viewer can help validate a synthetic payload before signing.

If decoding works and your application rejects the token, compare the failure message and the expected configuration. A signature failure suggests inspecting the test key and the algorithm configured for that verifier. A claim failure calls for comparing the relevant claim with the application’s expectations. Avoid making several changes at once. Change one fixture input, regenerate it, and run the same test so you can distinguish which change mattered.

When you save a reproducible test case, document the expected outcome. Record the synthetic claims, the verifier’s test configuration, and any fixed clock the fixture depends on. That context makes the test easier to repeat than a token string on its own. Keep test secrets in the appropriate local test configuration and share only values intended for the example.

Finish with the verifier that makes the decision

Before considering the test complete, inspect the decoded values and confirm the application handled them as expected. Check both the result for a valid synthetic fixture and the result for a fixture whose validation should fail. The TinyToolbox view helps explain what was encoded. The receiving application’s verification result is the evidence of what it actually accepts.

Read a fixed-clock fixture without using the current time

Suppose a local test uses 2025-01-01T00:00:00Z as a fixed clock. Its synthetic payload specifies iat as 1735689600, nbf as 1735689660, and exp as 1735689900. Read each value with the seconds mode in Unix Timestamp Converter. The issued-at value is midnight, the not-before time is one minute later, and expiration is five minutes after midnight.

Write the three converted values beside the test cases. At the fixed midnight clock, the token’s not-before time is still in the future. A test at 00:02 UTC is inside the indicated window, and a test at 00:06 UTC is after expiration. Check the verifier’s configured clock tolerance when designing tests close to a boundary. Other requirements, including signature verification and any required issuer or audience, still apply. The dates only explain the time claims.

When the fixture is displayed in JWT Decoder, check the type and unit of each time value. A number expressed in milliseconds can produce a time far outside the intended window if interpreted as seconds. A quoted number is a string in JSON, so consult the verifier’s claim requirements before expecting it to behave the same way as a number. Keep the documented claim values and the actual decoded payload side by side.

If a historical test has a fixed clock, avoid comparing the fixture with the date on your laptop to decide whether it should pass. First confirm the test clock the verifier is configured to use. Then run the test and record its outcome. Adding UTC labels to the fixture makes it easier to review, while the verifier’s result tells you whether the application enforced the expected rules.

Use the same fixed time and change only one claim when investigating an unexpected result. For example, compare a fixture at 00:02 UTC with another that uses the same time claims but names a different fictional audience. If a test fails, the decoded view makes it easy to confirm which field you intended to vary. Keep synthetic values in your notes instead of pasting credentials from a live session. For a shared report, include the claim name, expected value, observed value, and whether the difference affected decoding or the verifier’s decision.