--- title: "X-Content-Type-Options: nosniff" category: security status: required url: https://webspecification.com/spec/security/x-content-type-options/ updated: "2026-05-29T09:13:20.000Z" sources: - title: "MDN — X-Content-Type-Options" url: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/X-Content-Type-Options" publisher: "MDN" - title: "Fetch Standard — MIME type checks" url: "https://fetch.spec.whatwg.org/#x-content-type-options-header" publisher: "WHATWG" - title: "OWASP Secure Headers Project" url: "https://owasp.org/www-project-secure-headers/" publisher: "OWASP" source_repo: undefined licence: CC-BY-4.0 --- # X-Content-Type-Options: nosniff > The nosniff header stops browsers from guessing a response's content type. It blocks a class of attacks where a benign-looking file is interpreted as script or stylesheet. ## What it is `X-Content-Type-Options: nosniff` is a response header that tells the browser to trust the `Content-Type` you sent and not to guess. It takes exactly one value: `nosniff`. ```http X-Content-Type-Options: nosniff ``` The Fetch Standard makes this behaviour normative: when `nosniff` is present, the browser blocks script and stylesheet responses whose declared MIME type does not match the request. ## Why it matters Historically, browsers performed "MIME sniffing" — looking at the bytes of a response and second-guessing the server's `Content-Type`. That convenience was also an attack surface. An attacker who could upload a file to a user-content directory could craft something that looked like an image to the server but executed as JavaScript when included with `