CSP Nonce Generator
NetworkGenerate a cryptographically random base64 nonce for a Content-Security-Policy script-src/style-src directive, with a ready-to-paste header snippet and matching <script nonce="...">/<style nonce="..."> tag.
The shipped CSP Header Builder only supports a nonce placeholder in its script-src/style-src output, since the real value has to be a fresh, unpredictable string generated on the server for every single response, never something you could type in by hand or reuse. This tool generates that actual value: a cryptographically random byte string, base64-encoded per the CSP spec, alongside the exact script-src and style-src directive text and the matching HTML script/style tag attribute. Use it to see the expected shape of a nonce while wiring up your server-side generation code, or to quickly hand-test a nonce-based policy locally. It is not a substitute for generating the nonce server-side per request in production, since a nonce reused across responses defeats its entire purpose.
How to use CSP Nonce Generator
- 1.Pick how many random bytes to use (16 bytes / 128 bits is the CSP spec's recommended minimum).
- 2.Click Generate new nonce to produce a fresh cryptographically random value.
- 3.Copy the header directive and the matching script/style tag, using the same nonce in both for a single response.
Frequently asked questions
Use via API, SDK, or MCP
cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/csp-nonce-generator \
-H "Authorization: Bearer utx_live_..." \
-H "Content-Type: application/json" \
-d '{"byteLength":16}'Get an API key from your dashboard · Full API docs →