PKCE Generator (OAuth code_verifier / challenge)

Create a PKCE code_verifier and its S256 code_challenge for OAuth, with a random state and nonce. You can also paste your own verifier to get its challenge.

Use the tool

Why this tool exists

PKCE protects the OAuth authorisation code flow for public clients such as single-page apps and mobile apps. The client invents a secret verifier, sends only its SHA-256 hash in the authorisation request, and later proves it owns the secret when exchanging the code.

While you are integrating with an identity provider, it helps to produce a matching pair by hand and test the endpoints with curl or Postman. This tool makes a verifier of 43 to 128 characters from the allowed set, hashes it with SHA-256 using your browser crypto API, and encodes the result as Base64URL. In a real app, generate a fresh verifier for every login request in code; do not reuse values from a web page.

How to use it

  1. Choose a verifier length between 43 and 128, or paste your own verifier.
  2. Read the code_verifier, code_challenge, method, state and nonce.
  3. Use the challenge in the authorise request and the verifier in the token request.

Frequently asked questions

Why only S256?

RFC 7636 recommends S256 whenever the client can compute SHA-256, and the plain method offers little protection. The tool outputs code_challenge_method=S256.

What characters can a verifier contain?

Letters, digits, hyphen, dot, underscore and tilde, with a length of 43 to 128. A pasted value outside this rule is rejected with an error.

Should I use generated values in production?

No. Use them to test and learn the flow. A real client should generate a new random verifier per authorisation request, in code, and keep it only in memory or session storage until the token exchange.

What are state and nonce for?

State ties the response to your request and defends against cross-site request forgery. Nonce, used with OpenID Connect, ties the ID token to the request and defends against replay.