Canvas fingerprinting

On this page 7

Canvas fingerprinting is a browser tracking technique that instructs the HTML5 canvas element to draw hidden text and shapes, reads back the resulting pixels and converts them into a stable identifier for the device. In privacy and online tracking, it is a form of stateless identification: nothing is stored on the device, so clearing cookies or opening a private window does not remove the signal.

The method works because identical drawing instructions produce slightly different pixels on different combinations of graphics hardware, drivers, operating system, fonts and browser version. Canvas output is rarely unique by itself, but it adds substantial entropy to a broader device fingerprint and is among the most widely deployed fingerprinting vectors on the web.

How canvas fingerprinting produces an identifier

A canvas fingerprint is produced by a short script that renders content off screen and hashes the pixel data. The visitor sees nothing, because the canvas is never attached to the visible page or is sized to zero.

  1. The script creates a canvas element through the Canvas 2D API or, in a related variant, a WebGL context.
  2. It draws a test pattern: a text string in several fonts, often including emoji, plus overlapping shapes, gradients, shadows and alpha blending.
  3. It reads the result with toDataURL() or getImageData(), which returns the encoded image or raw pixel values.
  4. It computes a hash of the pixel data, typically 32 to 64 hexadecimal characters, and sends it to a server alongside other attributes.

The differences come from the rendering pipeline. Font rasterization, subpixel antialiasing, hinting rules, GPU-accelerated compositing, color management and floating-point rounding all vary between systems. Two laptops with the same browser can still produce different hashes if their graphics drivers or installed fonts differ.

The following table lists the main components of a typical test pattern and the system property each one exposes.

Drawn elementSystem property exposedTypical source of variation
Text in a fallback fontInstalled fontsFont substitution differs by operating system
Emoji charactersEmoji font versionPlatform emoji sets change with updates
Antialiased curvesRasterizer behaviorSubpixel rendering and hinting settings
Gradients and shadowsGraphics pipelineGPU, driver and blending precision
Semi-transparent overlapsCompositing mathFloating-point rounding differences
Elements of a canvas test pattern and what they reveal

Stability, uniqueness and entropy of canvas hashes

A tracking signal is useful only if it is both distinctive across users and stable over time for one user. Canvas hashes score reasonably on both, which explains their popularity, but neither property is absolute.

Uniqueness depends heavily on the population. On a fleet of identical corporate laptops, most canvas hashes collide. Across the general web, measurement studies have reported canvas output contributing roughly 5 to 10 bits of entropy, enough to split a population into hundreds of groups but rarely enough to single out an individual. Combined with other attributes, such as screen size, time zone, language and audio processing output, it helps form a fingerprint that may be unique for a large share of browsers.

Stability is limited by software change. Browser updates, driver updates and new font packages can alter the hash, so trackers commonly use fuzzy matching that links a new fingerprint to an older one when most other attributes still agree.

FactorEffect on uniquenessEffect on stability
Diverse hardware populationIncreasesNeutral
Standardized corporate devicesDecreases sharplyHigh
Frequent browser updatesNeutralDecreases
Graphics driver changesNeutralDecreases
Mobile devices of one modelDecreasesModerate
Factors that affect canvas fingerprint quality

Canvas fingerprinting compared with other tracking methods

Canvas fingerprinting is one input to device fingerprinting, not a complete tracking system on its own. Its defining characteristic is that it requires no storage on the device, which separates it from cookies, supercookies and advertising identifiers.

The comparison below places it among neighboring techniques in web tracking.

TechniqueStores data on deviceSurvives cookie clearingMain countermeasure
Canvas fingerprintingNoYesCanvas randomization or blocking
HTTP cookiesYesNoCookie deletion and partitioning
SupercookiesYes, in unusual storesOftenStorage partitioning
WebGL fingerprintingNoYesReporting generic GPU strings
Audio fingerprintingNoYesAudio output noise
Advertising IDYes, at system levelYesResetting or disabling the ID
Canvas fingerprinting and related tracking techniques

Because the identifier is recomputed on every visit, canvas fingerprinting also enables cross-site tracking when the same third-party script runs on many websites. That property makes it attractive to advertising networks and also to fraud detection and bot management services, which use it to recognize suspicious devices.

Defenses against canvas fingerprinting

Browsers and extensions defend against canvas fingerprinting with three broad strategies: blocking readback, adding noise and making outputs uniform. Each has a different cost in compatibility and protection.

ApproachHow it worksMain drawback
Permission promptAsks before returning canvas pixelsUsers often approve without understanding
Randomized noiseAdds small per-session pixel changesNoise can be averaged out by repeated reads
Uniform outputAll users return the same imageRequires strict control of fonts and rendering
Script blockingBlocks known fingerprinting domainsMisses first-party and unknown scripts
Main defensive approaches and their trade-offs

Tor Browser follows the uniformity principle and returns a blank or standardized image unless the user grants permission. Firefox includes canvas protections in its Resist Fingerprinting mode and blocks known fingerprinting scripts through Enhanced Tracking Protection. Brave and Safari apply forms of randomization or simplification to reduce the value of canvas readback. Tracker blockers such as uBlock Origin and Privacy Badger complement these measures by blocking scripts from known tracking domains.

A frequent misconception is that a private browsing window prevents canvas fingerprinting. Private mode clears stored state, but the rendering stack stays the same, so the canvas hash normally stays the same as well.

In the European Union, canvas fingerprinting falls under the same consent rule as cookies. Article 5(3) of the ePrivacy Directive covers access to information on terminal equipment regardless of the technology used, and European data protection authorities have confirmed that fingerprinting requires prior consent unless it is strictly necessary for a service the user requested. Under the GDPR, a fingerprint linked to a person is personal data.

Enforcement is difficult because the technique is hard to detect from the outside. Auditors typically instrument browsers to log calls to toDataURL() and getImageData() on canvases that are never displayed, then check whether the output leaves the page. Legitimate uses of canvas, such as image editors and charts, complicate this analysis, so context and data flow decide whether a call is fingerprinting.

The short version

Every computer draws pictures in a slightly different way, much like two printers that print the same photo with tiny differences in color. A website can quietly ask your browser to draw a small hidden picture and then look at the exact result.

That tiny difference works like a name tag. It does not need cookies and does not disappear when you clear your history. Privacy-focused browsers fight back by blurring or standardizing the picture so that many people look identical.

Where it makes a difference

A privacy auditor reviews a news website for a regulator and loads the homepage in an instrumented browser with all cookies refused. The log shows that a third-party analytics script draws an invisible 240 by 60 pixel canvas containing a pangram, two emoji and an overlapping colored arc, then calls toDataURL() and sends a 64-character hash to an external server.

The auditor repeats the visit in a fresh profile on the same laptop and receives the identical hash, which confirms that the script recognizes the device without stored data. Because no consent was collected, the finding is reported as fingerprinting without a legal basis. The publisher removes the script, and the follow-up audit shows no canvas readback before the consent banner is answered.