Skip to main content
Random values are generated with the browser’s crypto.getRandomValues, which draws from the operating system’s cryptographically secure source. Nothing here uses Math.random, which is predictable and must never be used for anything security-related.

Picking a length

Security depends on entropy, which is length combined with charset size. As a rough guide: For a webhook signing secret or an API token, 32 alphanumeric characters is a comfortable default.

Generating them in code

Treat generated secrets as production credentials the moment you use them. Store them in a secret manager, never in source control. See API keys and credential security.