free security tools
← Back to tools

CSP Hash Generator

Generate SHA-256, SHA-384, and SHA-512 hashes for inline scripts and styles. Use these hashes in your script-src or style-src CSP directives to allow specific inline code without 'unsafe-inline'. Click any hash to copy it.

Generated Hashes

Paste content above to generate hashes
Usage example in CSP:
Content-Security-Policy: script-src 'sha256-abc123...' 'strict-dynamic'; style-src 'sha256-def456...'

What is CSP Hash Generator?

Generate SHA-256 and SHA-384 hashes for inline scripts and styles to use in Content-Security-Policy headers.

FAQ

Why use hashes instead of unsafe-inline?
Hashes allow specific inline scripts while blocking all others. This maintains CSP protection without refactoring all inline code.
How do I add the hash to my CSP?
Add the generated hash to your Content-Security-Policy header in the script-src or style-src directive.

Related Tools