01What is PKCE Generator?
PKCE (Proof Key for Code Exchange, RFC 7636) protects the OAuth authorization code flow against a stolen code. Without it, an attacker who intercepts the code can swap it for tokens. Public clients such as mobile apps and single-page apps have no client secret to stop that. Before sending the user to log in, your app creates a random secret called the code_verifier. It sends only a hash of it, the code_challenge, in the authorization request. When it swaps the code for tokens, it sends the original verifier, and the server checks that the hash matches. A stolen code is useless without the verifier. This tool builds both values in your browser. The verifier uses only the characters RFC 7636 allows: A-Z, a-z, 0-9, hyphen, period, underscore and tilde. You choose a length from 43 to 128 characters, the range section 4.1 of the RFC sets. Random bytes come from the Web Crypto API. The tool discards bytes that would make some characters more likely than others, so each of the 66 characters is equally likely. The challenge uses the S256 method from section 4.2: the SHA-256 hash of the verifier, Base64url encoded with the trailing = padding removed. You can paste your own verifier to check it. If it is too short, too long or has a character outside the allowed set, the tool says which rule it breaks and does not compute a challenge. Here is a worked example. Paste the verifier from Appendix B of the RFC, dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk. The tool returns the challenge E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM, which matches the value printed in the RFC. Delete one character and the tool reports that the verifier is 42 characters and needs at least 43. The second panel builds the authorization request URL. It adds response_type=code, client_id, redirect_uri, scope, state, code_challenge and code_challenge_method=S256 to the endpoint you enter, and percent-encodes each value. These names come from section 4.1.1 of RFC 6749 plus the two PKCE fields. A random state value is filled in for you. The endpoint must be an absolute https URL, or http for local testing, and client_id is required. Limits: the tool does not offer the plain method, does not contact your authorization server and cannot check if your client_id or redirect_uri is registered there. It also does not perform the token request. In a real app, generate a fresh verifier for every login and keep it out of logs and URLs.
Developers building or debugging OAuth logins in single-page apps, mobile apps, CLIs and MCP clients. The tool runs entirely in your browser, so your data never leaves your device.
02How to use PKCE Generator
- Pick a verifier length between 43 and 128 and click Generate verifier, or paste an existing verifier
- Copy the code_challenge shown under it
- Enter your authorization endpoint, client_id, redirect_uri and scope
- Keep or regenerate the state value
- Copy the authorization request URL and open it in a browser
- When you exchange the returned code for tokens, send the same code_verifier
03Worked examples
- Input:
code_verifier: dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk - Result:
code_challenge (S256): E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM - The test vector from RFC 7636 Appendix B.
- Input:
code_verifier: 42 characters of 'a' - Result:
code_verifier is 42 characters; RFC 7636 needs at least 43. - The verifier is one character short, so no challenge is produced.
- Input:
Endpoint https://auth.example.com/authorize, client_id my-app, redirect_uri http://localhost:3000/callback, scope openid profile, state xyz123, the RFC verifier above - Result:
https://auth.example.com/authorize?response_type=code&client_id=my-app&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fcallback&scope=openid+profile&state=xyz123&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM&code_challenge_method=S256 - The authorize URL built from the RFC verifier, with the S256 challenge and method added.
- Input:
code_verifier: 128 characters (0-9, a-z, A-Z, -._~ then 0-9, a-z, A-Z again) - Result:
code_challenge (S256): -M3PRG_yFUX99qiorFlnC0W1egXPkF64JU809TJCnh4 - 128 characters is the upper limit, and the challenge is always 43 characters no matter how long the verifier is.
- Input:
code_verifier: the 128-character value above plus one more character - Result:
code_verifier is 129 characters; RFC 7636 allows at most 128. - One character over the limit is rejected.
- Input:
code_verifier: Zm9vYmFyYmF6+cXV4L3F1dXg9PTEyMzQ1Njc4OTAxMjM0NTY - Result:
code_verifier contains "+". Only A-Z, a-z, 0-9, "-", ".", "_" and "~" are allowed. - Standard base64 uses "+" and "/", which PKCE does not allow. Use base64url instead.
04Common use cases
- Testing an OAuth login flow by hand before writing client code
- Checking that your own PKCE code produces the same challenge for a given verifier
- Building an authorization URL to paste into a browser while debugging a provider setup
- Confirming a verifier meets the RFC 7636 length and character rules
- Showing a teammate how the verifier and challenge relate
05Tips
- Use a new verifier for every authorization request; never reuse one
- Store the verifier where only your app can read it, such as session storage in a single-page app
- Check that the state value in the callback matches the one you sent
- Load the RFC test vector example to check your own implementation gives the same challenge
06Related concepts
OAuth 2.0, Authorization code flow, code_verifier, code_challenge, S256, RFC 7636.
Frequently Asked Questions
What is PKCE Generator?
PKCE Generator is a free, browser-based developer tool on AIDToolStack. Generate an RFC 7636 PKCE code_verifier and S256 code_challenge in your browser, then build the OAuth authorization request URL. It requires no installation or sign-up and works entirely in your browser.
Is PKCE Generator free to use?
Yes. No sign-up, no fees and no usage cap.
Does PKCE Generator store my data?
No. It runs in your browser; nothing is uploaded.