X-Frame-Options Generator

Generate X-Frame-Options and CSP frame-ancestors headers to prevent clickjacking. Get ready-to-paste server config snippets for Nginx, Apache, and IIS.

Framing Policy

Generated Headers

X-Frame-Options

            
CSP frame-ancestors (recommended)

            

Server Configuration Snippets


            

What is Clickjacking?

Clickjacking (UI redress attack) tricks users into clicking elements they cannot see. An attacker embeds your site in a transparent iframe placed over a decoy page. When the user thinks they are clicking a harmless button, they are actually interacting with your site — transferring money, changing settings, or approving permissions without their knowledge.

Setting X-Frame-Options or Content-Security-Policy: frame-ancestors instructs browsers to refuse to render your page inside an iframe unless it comes from an allowed origin.

X-Frame-Options
Legacy HTTP header. Supported by all browsers including IE. Does not support multiple origins. ALLOW-FROM is deprecated and unsupported in Chrome/Firefox.
CSP frame-ancestors
Modern standard. Supports multiple origins, wildcards, and nonces. Takes precedence over X-Frame-Options in modern browsers. Recommended for all new deployments.
Copied!

Summary

Generate X-Frame-Options and CSP frame-ancestors headers to prevent clickjacking. Get ready-to-paste server config snippets for Nginx, Apache, and IIS.

How it works

  1. Select a framing policy. DENY blocks all framing. SAMEORIGIN allows framing only from the same origin. ALLOW-FROM restricts framing to a specific URI — note this option has limited browser support and is deprecated in many browsers in favour of CSP frame-ancestors. The tool immediately shows the correct header syntax and equivalent Content-Security-Policy frame-ancestors directive, plus server configuration blocks you can paste directly into your web server.

Use cases

  • Prevent clickjacking by ensuring your login or payment pages cannot be embedded in iframes.
  • Allow a known partner domain to embed your widget while blocking all others via CSP frame-ancestors.
  • Generate Nginx, Apache, or IIS config snippets ready to paste into your server configuration.
  • Migrate from deprecated X-Frame-Options ALLOW-FROM to the CSP frame-ancestors equivalent.

Frequently Asked Questions

Last updated: 2026-06-09 · Reviewed by Nham Vu