How to Detect Windows 11
Reported Windows Version Is No Longer Reliable
Windows 11 cannot be reliably distinguished from Windows 10 using the user-agent string alone. Browsers on Windows 11 can still report the operating system as Windows NT 10.0:
WHY?
Since the rollout of user-agent reduction, Chromium-based browsers report Windows NT 10.0 for Windows 10 and later.

Detecting Windows 11 with UAParser.js
UAParser.js can use Client Hints to identify Windows 11 when the browser provides the platform version.
Browser-side Detection
Use withClientHints() to read the additional information from the browser:
import { UAParser } from 'ua-parser-js';
const uap = new UAParser();
// User-Agent only
console.log('Based on user-agent:', uap.getOS());
// { name: "Windows", version: "10" }
// User-Agent + Client Hints
uap.getOS().withClientHints().then(os => {
console.log('Based on Client Hints:', os);
// { name: "Windows", version: "11" }
});Server-side Detection
On the server, request the platform version using Accept-CH, then pass the incoming headers to UAParser.js:
import { createServer } from 'node:http';
import { UAParser } from 'ua-parser-js';
createServer((req, res) => {
res.setHeader('Accept-CH', 'Sec-CH-UA-Platform, Sec-CH-UA-Platform-Version');
const uap = new UAParser(req.headers);
const os = uap.getOS().withClientHints();
res.end(JSON.stringify(os, null, ' '));
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');The browser may send the requested hint on a subsequent request. Until it is available, the result falls back to the user-agent and may report Windows 11 as Windows 10.
LIMITATION
Client Hints require a secure context, such as HTTPS or localhost, and only supported by Chromium-based browsers such as Chrome and Edge. Firefox and Safari do not support User-Agent Client Hints, so the reported version may remain Windows 10.
