RankHush Tools
developer tools

JWT Encoder with HS256 Signing

Create an HS256 JWT online for free, with no sign up. Enter a JSON header and payload, provide a test secret, and generate a signed token using your browser’s cryptography API. Use the result for development experiments and keep production signing keys in your application’s secure key-management workflow.

Made for a smoother workflow

Tool features

Everything you need to get the job done, without the extra steps.

  • Create a JWT from JSON header and payload objects
  • Sign tokens with HS256 using a shared secret
  • Add standard or custom JWT claims
  • Copy the generated token with one click
  • Perform signing locally with browser cryptography
  • No account required

Simple from start to finish

How to use this tool

4 steps
  1. 01Review or edit the JSON header and payload.
  2. 02Keep the header alg field set to HS256.
  3. 03Enter the shared secret that will sign the token.
  4. 04Generate the JWT and copy it for your development or testing use.

Practical guide to JWT Encoder

By RankHush Tools · Updated

What this JWT encoder creates

A JSON Web Token is a compact way to carry claims between systems that agree on how to validate them. A typical signed JWT contains a header, payload and signature separated by periods. The header and payload are Base64URL-encoded JSON, so signing does not make their contents confidential.

This JWT generator supports HS256, an HMAC-based signing algorithm using a shared secret. The same secret is involved in creating and verifying the signature. A generated token is meaningful only to an application configured to trust the corresponding key and to apply its own issuer, audience, expiry and authorization checks.

Encode a JWT with a secret key

Start with a JSON header containing alg set to HS256 and a JSON object as the payload. Review the sample, enter a test secret and generate the token. For a simple JWT working example, a payload such as {"sub":"test-user","role":"reader"} carries two claims, but your application decides whether either claim is acceptable.

The tool requires a non-empty secret and uses the browser’s Web Crypto API for signing. It does not choose a secure production secret for you. Use a dedicated test key for experiments and never paste a production private key into this interface. Keep test outputs separate from credentials accepted by a live application.

Encoding is not encryption or verification

A JWT encoder and decoder perform different tasks. Encoding constructs the serialized token and, in this tool, signs it with HS256. Decoding makes its encoded JSON readable. Verification checks whether a signature matches a trusted key and whether the application’s claim requirements are met.

After generating a sample, open the related decoder to inspect the header and payload. That round trip helps explain the format, but it does not prove the token should grant access. A useful development check is to verify the signature using your application’s own configured validation code and test key.

Supported algorithms and browser requirements

This version signs with HS256 and requires a secret. It does not create unsigned tokens or sign with asymmetric key pairs such as RS256 or ES256. Keep the algorithm consistent with the configured receiver. Changing an algorithm label alone does not turn an HS256 signature into another algorithm or supply the keys a different algorithm requires.

A secure browser context such as HTTPS is required for the cryptography API. If generation fails, check that the header and payload are JSON objects, that the algorithm is HS256 and that a secret has been entered. For a reproducible development test, keep the exact test inputs and verify the output in the receiving application with its normal validation enabled.

Start with a development signing exercise

Use this encoder when you want to see how a JSON header and payload become a compact HS256-signed token. Begin with sample data and a dedicated test secret that is not accepted by any live application. Review each field before generating the output. The useful result is a token you can inspect and test in an environment you control, not a credential that automatically works with an unrelated website.

A token signed with your own arbitrary secret will fail at a server that trusts a different key. That failure is expected and is part of what signatures are designed to enforce. The tool does not discover an application's secret, register your chosen key with an issuer or grant account access. Keep the exercise connected to a clearly configured development receiver.

Prepare header and payload as JSON objects

The header must contain alg set to HS256. You can use a conventional typ value such as JWT when appropriate for your protocol. The payload must also be an object rather than an array, a number or a quoted block of JSON. Use double quotes, remove trailing commas and supply valid JSON values. The JSON Formatter can help identify a syntax mistake before you return to signing.

For example, a payload containing {"sub":"demo-user","scope":"read:catalog"} can demonstrate how claims appear in a decoded result. Whether a receiver recognizes that scope or subject is a separate configuration question. Use field names and values documented for your own test application, and avoid inventing production privileges simply because a token can carry a string describing them.

Add time claims deliberately

If your test protocol expects exp, nbf or iat, provide numeric seconds rather than a JavaScript millisecond timestamp. Calculate them against the intended test clock and make the lifetime appropriate for the scenario. This encoder signs the payload you supply; it does not automatically create a sensible expiry, reject an expired claim or enforce an issuer's token lifetime policy.

It is useful to create several controlled cases: a token acceptable now, an already expired token and a token whose not-before value is still in the future. Submit each to your development receiver and record its response. These tests make a timing rule observable. Do not rely on a very distant sample expiry as the template for production session design.

Understand what the HS256 signature covers

The header and payload are serialized, encoded as Base64URL and joined with a period. The HS256 operation signs that joined input using HMAC with SHA-256. The resulting signature becomes the third segment. Changing a claim or even changing the serialized signing input requires a new signature. Replacing only the visible payload segment leaves the old signature inconsistent with the new data.

HS256 is symmetric: a party with the signing secret can also create signatures. That has implications for how services share trust and store keys. A public verification key from an asymmetric setup is not an interchangeable HS256 secret. This tool does not implement RS256 or ES256, and changing the algorithm label cannot turn one kind of cryptographic operation into another.

Use the secret field with clear expectations

The encoder interprets the secret you enter as UTF-8 text. It does not automatically Base64-decode that text into different key bytes. If your application's configuration stores a secret in an encoded representation, determine whether its verification library uses the decoded bytes or the literal characters. A mismatch here can produce different signatures even when both screens seem to display the same secret.

Use a separate test key for browser experiments. Generate and manage production signing keys through the project's approved secret-management process, using the algorithm's requirements and the receiving library's documentation. A non-empty field is a usability check, not a cryptographic assessment of the key's strength. The page does not certify that a chosen secret has enough entropy for your application.

Verify a generated token independently

After generation, copy the token to the JWT Decoder to inspect the readable header and payload. Check the fields you intended to sign. Then verify the signature in the receiving application's maintained JWT library using the same test key bytes and an explicit HS256 allowlist. Also apply issuer, audience and time checks required by the protocol. Inspection and full acceptance are separate stages.

Use a negative test as well. Change a payload value in a controlled test token without recomputing the signature and confirm that your receiver rejects it. This helps catch a validation path that merely decodes a token and trusts the claims. Do not use a visually plausible token as evidence that a server enforces the properties you need.

Keep confidential information out of the payload

The payload is encoded rather than encrypted. Someone holding the token can ordinarily read its header and payload without knowing your secret. Avoid placing passwords, private keys or unnecessary personal information there. A claim can point to an internal record instead of copying an entire private profile into every token. Consider how tokens may appear in logs, browser tools and support screenshots.

Signing protects a specific integrity relationship when a trusted receiver verifies it correctly; it does not make every storage or transport choice safe. Your application remains responsible for how tokens are delivered, retained and revoked or replaced under its design. This browser page does not configure cookies, implement logout or stop an already issued token from being accepted elsewhere.

Resolve signing failures systematically

Check the JSON validation messages first, then confirm the algorithm is HS256 and the secret is present. The Web Crypto signing operation requires a secure browser context such as HTTPS. If the browser blocks the cryptography API, use an appropriate current browser and secure page rather than rewriting the token by hand. The tool cannot create a correct signature by simply concatenating an arbitrary third segment.

If generation succeeds but verification fails elsewhere, compare exact key bytes, signing algorithm, payload and receiver settings. Copy the current generated token after any input change; an earlier output belongs to the earlier inputs. Record the test case without exposing a live secret in a bug report. Keep the exercise reproducible with dummy data so another developer can investigate it safely and accurately.

Helpful answers

Frequently asked questions

Is the online JWT encoder free?

Yes. You can generate HS256 test tokens for free without signing up. The header, payload and secret are processed by the browser’s cryptography API on your device.

How do I encode a JWT with a secret key?

Enter JSON objects for the header and payload, keep alg set to HS256, and supply a test secret. Generate the token and copy the result. Use your application’s trusted verification code to check it before relying on it.

Can I encode a JWT without a secret or key?

Not with this tool. It requires a non-empty secret for HS256 signing and rejects unsupported algorithms. Unsigned tokens and alg none are not supported.

Can I sign with a public key or private key?

No. This encoder supports shared-secret HS256, not asymmetric signing such as RS256 or ES256. It has no public-key or private-key import feature.

Does JWT encoding hide the payload?

No. The header and payload are Base64URL representations that can be decoded without the signing secret. Signing helps a configured verifier check integrity and authenticity; it does not provide confidentiality.

Why is the token generator not working?

Confirm that the page is served over HTTPS, your browser supports Web Crypto, the JSON is valid, the header declares HS256 and a secret is present. Read the displayed error before changing input or trying again.

Can I use this as a production token issuer?

This page is intended for development and inspection workflows. Issue production tokens in a controlled application with appropriate key management, claim validation and access controls. A copied browser-generated token does not establish an authentication system.

Keep exploring

Related tools

A few more handy tools that may fit your workflow.

Developer Tools

JWT Decoder

Inspect JWT headers, payloads and expiry locally. Signatures are not verified.

Open Tool
Developer Tools

JSON Formatter & Validator

Format, minify and validate JSON with readable output and syntax feedback.

Open Tool
Developer Tools

UUID Generator

Generate secure random UUID v4 identifiers in bulk and copy them in one click.

Open Tool
Developer Tools

Base64 Encoder & Decoder

Encode Unicode text to Base64 or decode Base64 into readable text instantly.

Open Tool

Found this useful?

Share this tool with someone who might find it handy.