Anti-Bot

What Is Math & JS Engine Fingerprinting?

What Is Math & JS Engine Fingerprinting? — conceptual illustration
On this page

Math fingerprinting identifies a runtime by computing transcendental functions (sin, cos, tan, exp, log, pow) at fixed inputs and reading the least-significant bits of the results. Those bits depend on the CPU’s floating-point unit, the system math library (libm) implementation, and the JavaScript engine’s own approximations. The values are deterministic per platform, so they form a stable, hard-to-fake signal that also reveals the true engine behind a spoofed User-Agent.

Quick facts

ReadsLast bits of Math.acos, atanh, expm1, sinh, pow, etc.
Varies byCPU FPU, libm version, V8 vs SpiderMonkey vs JavaScriptCore
CostMicroseconds — runs on every page load
RevealsA "Safari" UA running on V8 (i.e. a faker)
RelatedWASM timing, hardware concurrency, device memory

Why the same formula gives different bits

IEEE-754 only guarantees the precision of basic operations (+, −, ×, ÷, sqrt). Transcendental functions like Math.tan or Math.expm1 are implementation-defined in their last bit or two. Chrome’s V8, Firefox’s SpiderMonkey, and Safari’s JavaScriptCore each ship different math routines, and those routines may further defer to the platform libm. The upshot: Math.tan(1e300) or Math.sinh(1) returns a value whose final hex digits identify the engine + OS combination.

Because the result is identical every run on a given machine, it slots neatly into a composite browser fingerprint with zero variance noise.

How it exposes spoofed browsers

This is the signal that punishes lazy User-Agent spoofing. If a scraper sets a Safari UA but runs headless Chrome, the math battery returns V8’s values, not JavaScriptCore’s. A lie detector compares the math signature against the claimed engine and flags the mismatch. The same trick catches Chrome-on-Linux pretending to be Chrome-on-Windows when paired with other OS signals.

There is no JavaScript-level fix: you cannot reimplement libm to match a different platform without reimplementing the engine. Real coherence comes from running the actual browser+OS you are claiming — which is why anti-detect stacks pin the whole environment, not just the UA string.

Why you cannot spoof your way out

The differences exploited here come from the JavaScript engine and the CPU's floating-point unit — the last bits of Math.tan(-1e300) or Math.sinh() differ between V8 (Chrome), SpiderMonkey (Firefox) and JavaScriptCore (Safari), and again across hardware. You cannot patch these results convincingly from inside a content script without re-implementing the math, and any wrapper you add is itself detectable. The result is that the engine signature has to genuinely match the browser you claim to be.

That makes engine fingerprinting a coherence test more than a value test: a tool that runs the SpiderMonkey engine must present a Firefox identity, not a Chrome one, or the math bits and the User-Agent disagree. This is why Camoufox is built on Firefox and reports as Firefox — and why bolting a Chrome User-Agent onto a non-V8 runtime is caught instantly by a lie detector.

Related terms

Concept map

How Math & JS Engine Fingerprinting connects

The terms most directly tied to this one. Hover a node to see its neighbours, click to preview, drag to rearrange.

0 terms · 0 connections
You are here · Anti-Bot
Building map…

Frequently asked questions

Is math fingerprinting high-entropy on its own?

No — it mostly identifies the engine + OS family, not the individual device. Its value is consistency and as a lie-detector cross-check, not standalone uniqueness.

Can I randomise the math results?

Patching Math functions in JS is detectable (the patched function fails the native-code toString check) and randomising breaks the stable-per-machine expectation. It does more harm than good.

Does WebAssembly have the same issue?

WASM math is more strictly specified, but WASM SIMD timing and rounding still leak engine details, which is why anti-bots increasingly pair Math probes with WASM ones.

Last updated: 2026-05-28