Anti-Bot

What Is Canvas Fingerprinting?

What Is Canvas Fingerprinting? — conceptual illustration
On this page

Canvas fingerprinting is a way for a website to identify your device by asking the browser to draw a tiny invisible image, then turning the resulting pixels into a short ID (a hash). Here is the trick: the exact same drawing instructions come out slightly differently on different GPUs, graphics drivers, and operating systems. That variation is enough to tell one device apart from another, and consistent enough to instantly expose a headless browser (a browser with no visible window, often used by bots) or a software-only renderer.

Quick facts

Introduced2012 academic paper, mainstream by 2016
How it variesGPU model, driver version, sub-pixel rendering, OS font stack
Used byAkamai, DataDome, PerimeterX, Cloudflare Turnstile
Tells onHeadless Chrome, SwiftShader, Mesa llvmpipe (known hashes)
Varies withReal GPU, Camoufox, CloakBrowser (C++ rendering patches)

How canvas fingerprinting works

A script adds a hidden <canvas> element (a drawing surface) to the page, draws shapes, gradients, and text on it using canvas.getContext("2d"), then calls canvas.toDataURL() to read the pixels back out. The exact pixels depend on several things: the GPU brand and model, the driver version, how the OS renders fonts (Windows ClearType vs macOS CoreText), and canvas DPI scaling (how pixels map to the display). Hashing that pixel data gives a short identifier that stays the same for one device across visits, and differs from almost every other device.

WebGL fingerprinting does the same thing but for 3D rendering, and it gives away even more: it can read the GPU name directly via gl.getParameter(gl.RENDERER). Real Chrome returns something like ANGLE (Intel, Intel(R) UHD Graphics 620 Direct3D11 vs_5_0 ps_5_0), while headless Chrome with no GPU returns a generic software string or fails to start the WebGL context at all.

Why scrapers get caught

Headless browsers usually run on servers with no GPU, so they fall back to software rendering — either Chrome's built-in SwiftShader or Mesa llvmpipe on Linux. Both are predictable: they always produce canvas hashes from a small, known set. Anti-bot systems keep a catalogue of these hashes and flag any visitor that matches one. Worse still, if the script asks for the WebGL renderer string and gets SwiftShader Device 0x0000C0DE, that exact value is already on a blocklist.

Trying to fix this by overriding toDataURL() in JavaScript backfires. Checking Function.prototype.toString.call(canvas.toDataURL) shows the modified source code instead of the expected [native code] marker — so the patch itself becomes the giveaway that this is a bot.

How consistent canvas rendering works

Approaches that produce consistent results work deep in the browser's C++ rendering code, not in JavaScript. CloakBrowser patches Chromium's rendering layer to add a tiny, consistent amount of noise to the pixels before toDataURL() returns them — every profile gets a different hash, yet the image looks identical to the eye. Camoufox does the same for Firefox using patches applied when the browser is built. The gold standard is still real browsers on real consumer hardware: an actual laptop with an Intel integrated GPU produces a genuine canvas hash that no blocklist will match.

A 2026 development makes this messier: services like Bablosoft PerfectCanvas now sell real canvas hashes harvested from real consumer GPUs, which can be replayed into headless sessions. In response, anti-bots are combining canvas checks with signals that are harder to fake — like WASM SIMD timing (how fast the CPU runs certain math) and the physics of mouse movement (behavioural Bezier curves) — so a clean canvas hash on its own no longer proves a browser is real.

PerfectCanvas — replaying a real machine's output

The naive approach is to add random noise to the canvas pixels. It fails because anti-bot vendors expect each machine to give stable output: a hash that changes on every page load looks more bot-like than a hash that is wrong but consistent. The current best technique is canvas replay, made popular by the PerfectCanvas project that ships inside multilogin and several commercial anti-detect browsers.

It works in two steps: (1) on a real machine, run a large set of known drawing operations and save the resulting pixel data, then (2) when the headless browser is asked to draw any of those same operations, hand back the pre-recorded real pixels instead of the degraded SwiftShader output. The result is byte-for-byte identical to the real machine for any test the vendor knows to run, and it stays consistent within a session — exactly what a real device looks like.

The weak spot is unfamiliar drawing operations. A vendor that suspects replay can request a render the database has never seen — the headless browser then falls back to its real (broken) output, and the mismatch gives it away. The whole contest comes down to whether the replay database covers more operations than the vendor's tests probe.

Code example

javascript
// What every anti-bot script runs to fingerprint your browser
function canvasFingerprint() {
  const canvas = document.createElement('canvas');
  const ctx = canvas.getContext('2d');
  ctx.textBaseline = 'top';
  ctx.font = '14px Arial';
  ctx.fillStyle = '#f60';
  ctx.fillRect(125, 1, 62, 20);
  ctx.fillStyle = '#069';
  ctx.fillText('Cwm fjordbank glyphs vext quiz', 2, 15);
  return canvas.toDataURL();   // hashed and sent to the server
}

Related terms

What Is Browser Fingerprinting?
Browser fingerprinting is a technique that identifies and tracks a visitor by combining dozens of small, observable characteristics of their…
What Is Anti-Bot Detection?
Anti-bot detection is the set of techniques websites use to tell automated traffic apart from real human visitors — and then block, challeng…
What Is TLS Fingerprinting (JA3/JA4)?
TLS fingerprinting is a way to recognize what software made a connection just by looking at how it sets up encryption — before the server re…
What Is Camoufox?
Camoufox is a fork of Firefox with anti-fingerprinting patches applied at the C++ build level. That phrase matters: most anti-fingerprinting…
What Is WebGL Fingerprinting?
WebGL fingerprinting reads identifying information directly from the GPU. WebGL is the browser feature that lets web pages draw 3D graphics …
What Is AudioContext Fingerprinting?
AudioContext fingerprinting plays a silent waveform through the Web Audio API, then reads back the resulting floating-point samples and hash…
What Is Function.toString() Inspection?
Function.prototype.toString() inspection is a technique anti-bot scripts use to identify JavaScript functions that have been modified at run…
What Is WASM Fingerprinting?
WebAssembly (WASM) fingerprinting is a newer anti-bot technique that identifies a browser by measuring how its actual CPU behaves, instead o…
What Is Timing & Cache Side-Channel Fingerprinting?
Timing-based fingerprinting uses high-resolution clocks to measure how long operations take, turning microarchitectural and rendering behavi…
What Is Fingerprint Clustering?
Fingerprint clustering is the practice of grouping fingerprints from millions of real visitors by similarity, then rejecting any new visitor…
What Is Engine-Level (Blink) Browser Instrumentation?
Engine-level instrumentation means adding observation points inside the browser's C++ rendering engine (Blink), below the JavaScript layer, …
How Do You Instrument a Browser to Study Anti-Bot Scripts?
Instrumenting a browser means adding observation points so you can watch exactly which APIs a page calls -- which is how researchers study f…

Concept map

How Canvas 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

Can I disable canvas fingerprinting?

Real users can't easily turn it off without breaking pages. Privacy extensions like CanvasBlocker randomise the output, but that randomness is itself detectable — "this canvas hash is too random to be real hardware." For scraping you don't want to disable it at all; you want to look like a real device.

Do all browsers have the same canvas hash?

No. Even the exact same browser version on the same OS can produce different hashes on different machines, because the GPU and driver affect the pixels. That difference is precisely what makes the technique useful for fingerprinting.

Is canvas fingerprinting legal under GDPR?

Under GDPR (the EU's data protection law), canvas fingerprinting is generally treated as personal data because it identifies devices. Sites need a lawful basis (usually the user's consent) to use it for tracking. Using it purely for anti-fraud or bot defense is more commonly accepted under the "legitimate interest" basis.

What is the difference between canvas and WebGL fingerprinting?

Canvas uses 2D rendering and is faster; WebGL uses 3D rendering and also exposes the GPU name string. Anti-bots usually combine the two — a contradiction between them (for example, WebGL reports "Intel UHD 620" but the canvas hash matches a software renderer) is itself a strong bot signal.

Why is canvas noise injection a worse strategy than fixed spoofing?

Real machines give a stable canvas hash within a session — the same render always produces the same pixels. A scraper that randomises its hash on every page load stands out against the way real users behave. A scraper with a fixed-but-wrong hash at least looks like a single consistent machine.

Last updated: 2026-05-31