Skip to content
Free tool

Content Security Policy generator

A Content Security Policy tells browsers which scripts, styles and other resources your pages may load, so that an injected script cannot run. This generator starts from a strict policy and adds only what you name, or what your homepage loads if you ask it to read your site. The policy is built in your browser; only the address you ask us to read is sent to our server, and it is not stored.

Start from your site

We read your homepage the way a browser does, grade the policy it sends today, and add every script, style, image, font, media, frame and form source it uses to the generator, with hashes for its inline scripts. The address is not stored.

Mode
Services your pages use

Google Analytics or Tag Manager? Google lists the sources to add, which depend on your settings: Google's CSP guide.

Options
Who may show your pages in a frame
Only if you must
Other sources

Hosts such as cdn.example.com or https://cdn.example.com, separated by spaces or new lines, up to 60 per box. Keywords such as 'self' are added for you. For scripts and styles you can also add the hash of an inline block ('sha256-...').

An https address that collects violation reports. Leave empty if you have none.