PKCE Generator
LiveGenerate OAuth 2.0 PKCE code verifier and SHA-256 code challenge for secure authorization flows.
Understanding Data Encoding & Security
PKCE (Proof Key for Code Exchange, RFC 7636) is a security extension to the OAuth 2.0 authorization code flow designed to protect public clients (single-page apps, mobile apps) from authorization code interception attacks. It works by having the client generate a random code_verifier, derive a code_challenge from it using SHA-256, send the challenge to the authorization server, and prove possession of the verifier when exchanging the code for tokens. Generating cryptographically secure PKCE pairs requires the Web Crypto API.
Generate a cryptographically secure OAuth 2.0 PKCE (Proof Key for Code Exchange) pair: a random code_verifier (43–128 characters, URL-safe base64) and its SHA-256 derived code_challenge. Both are generated using the Web Crypto API in your browser. Copy values ready to use in your OAuth 2.0 authorization code flow with PKCE (RFC 7636).
The Devkitr PKCE Generator creates cryptographically secure code_verifier and code_challenge pairs using the Web Crypto API in your browser. Copy the values for use in your OAuth 2.0 authorization code flow with PKCE implementation.
In a typical development workflow, PKCE Generator becomes valuable whenever you need to generate oauth 2. Whether you are working on a personal side project, maintaining production applications for a company, or collaborating with a distributed team across time zones, having a reliable browser-based generation tool eliminates the need to install desktop software, write one-off scripts, or send data to third-party services that may log or retain your information. Since PKCE Generator processes everything locally on your device, your data stays private and your workflow stays uninterrupted — open a browser tab, paste your input, get your result.
Key Features
Cryptographic Randomness
Generates code_verifier using crypto.getRandomValues() — cryptographically secure, not Math.random().
SHA-256 Challenge Derivation
Derives the code_challenge from the verifier using SubtleCrypto.digest("SHA-256") then Base64url encodes without padding per RFC 7636.
Configurable Length
Generate code_verifiers between 43 and 128 characters (the RFC 7636 allowed range). Default is 64 characters.
Ready-to-Use Values
Copy individual values with click, or copy both as a JSON object for use in client configuration.
How to Use PKCE Generator
Generate
Click Generate to create a new cryptographically random code_verifier and its corresponding code_challenge.
Copy code_verifier
Store the code_verifier securely in session storage — you will need it for the token exchange step.
Use code_challenge in Authorization Request
Include code_challenge and code_challenge_method=S256 in the authorization URL query parameters.
Include code_verifier in Token Request
Send the code_verifier as a parameter when exchanging the authorization code for tokens at the token endpoint.
Use Cases
SPA OAuth Implementation
Generate PKCE pairs for testing your SPA's OAuth 2.0 authorization code flow with PKCE implementation in development.
Mobile App Authentication
Generate and test PKCE values before implementing the flow in your iOS or Android OAuth library.
OAuth Testing
Generate PKCE pairs to manually test an authorization server's PKCE support using curl or Postman.
Security Training
Demonstrate the PKCE mechanism to developers learning OAuth 2.0 security by showing the verifier → challenge transformation.
Pro Tips
Never reuse a code_verifier. Generate a fresh PKCE pair for each authorization request.
Store the code_verifier in sessionStorage (not localStorage) — it should only live for the duration of the authorization flow.
PKCE is now recommended for all OAuth 2.0 clients, not just public clients — the OAuth 2.0 Security Best Current Practice (BCP) recommends PKCE for confidential clients too.
Common Pitfalls
Sending the code_verifier instead of code_challenge in the authorization request
Fix: The code_challenge (hashed) goes to the authorization server. The code_verifier (unhashed original) goes to the token endpoint. Getting these backwards breaks the security guarantee.
Frequently Asked Questions
QWhat is PKCE?
PKCE (Proof Key for Code Exchange) is an OAuth 2.0 security extension for public clients (SPAs, mobile apps) that prevents authorization code interception attacks.
QIs the code_verifier truly random?
Yes. It is generated using crypto.getRandomValues() which is cryptographically secure.
QWhen do I use PKCE?
PKCE is required for all OAuth 2.0 public clients (SPAs, mobile apps) and is recommended for all authorization code flows regardless of client type.
Related Articles
Related Tools
Base64 Encoder/Decoder
Encode text to Base64 or decode Base64 strings back to readable text.
JWT Decoder
Decode and inspect JSON Web Tokens to view header, payload, and signature.
SHA256 Generator
Generate SHA-256 hash digests from text input for checksums and verification.
MD5 Generator
Generate MD5 hash digests from text for checksums and quick comparisons.
