Developer Tools
PKCE code verifier & challenge generator.
Generate a code_verifier and its S256 code_challenge for an OAuth 2.0 authorization-code flow with PKCE (RFC 7636). Or paste a verifier you already have and get its challenge.
Options
Result
Press Generate to create a code_verifier and code_challenge.
How it works
Per RFC 7636 section 4.1, the code_verifier is a high-entropy random string of 43 to 128 characters from the unreserved set A-Z a-z 0-9 - . _ ~. The RFC recommends taking 32 random octets and base64url-encoding them, which yields a 43-character verifier. This tool does exactly that with crypto.getRandomValues.
Section 4.2 defines the S256 method: code_challenge = BASE64URL-ENCODE(SHA256(ASCII(code_verifier))). The hash is computed with WebCrypto's crypto.subtle.digest('SHA-256'). Base64url (RFC 7636 Appendix A) is standard Base64 with + replaced by -, / by _, and the trailing = padding removed. Send code_challenge and code_challenge_method=S256 in the authorization request, then send the original code_verifier in the token request.
Check it yourself: the RFC's Appendix B verifier dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk produces the challenge E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM.
Frequently asked questions
Should I use plain or S256?
RFC 7636 says clients that can support S256 MUST use it; plain exists only for constrained clients that cannot hash. This tool generates S256 only.
Can I reuse a verifier?
No. Generate a fresh verifier for every authorization request and keep it only until the token request completes.
Is it safe to use a generated value in production?
The randomness comes from the browser's cryptographically secure generator, but in a real app your OAuth library should generate the pair in the client itself. Use this tool for testing, debugging, and learning the flow.
Generated entirely in your browser
The verifier and challenge are computed locally with WebCrypto. Nothing is sent to any server, and nothing is logged.