What is browser fingerprinting and how does it work?

Intermediate4 min readUpdated

GET /learn/detection/what-is-browser-fingerprinting/ Accept text/html text/markdown

Short answer

Browser fingerprinting identifies a browser by the values it exposes to every website: User-Agent, screen size, time zone, languages, fonts, graphics hardware and how it draws text and images. Combined, these values often single out one browser among many without storing anything on the device. Bot detection uses fingerprints to spot browsers that lie about themselves and to link many accounts to one device.

A website can learn a lot about a browser without storing anything on the device. Each value on its own is shared by millions of people, but the combination of a few dozen of them is often rare enough to recognise the same browser on a later visit, even after cookies are cleared. That combination is the browser fingerprint.

What does browser fingerprinting collect?

Some data arrives with every request, before any script runs. This passive part includes the IP address, the User-Agent header, Accept-Language, the order of headers, Chromium's client hints and the TLS handshake. The TLS fingerprint is covered on its own page.

The active part is read by JavaScript in the page:

  • Screen width, height, colour depth and pixel ratio, plus the size of the browser window.
  • Time zone from Intl.DateTimeFormat().resolvedOptions().timeZone and the list in navigator.languages.
  • CPU core count (navigator.hardwareConcurrency), memory class (navigator.deviceMemory, Chromium only), platform and touch support.
  • Installed fonts, found by measuring how wide a test string renders in each font.
  • The graphics card and driver names from WebGL, and the list of WebGL features supported.
  • The output of drawing to a canvas or processing a short sound with the Web Audio API.
  • Supported media codecs, permission states and storage limits.

How does canvas fingerprinting work?

The script draws text and shapes on a hidden canvas and reads the pixels back. The result depends on the graphics card, the driver, the operating system's font rendering and its anti-aliasing, so two machines that report the same browser version can produce different images. Hashing the image gives a short value to compare:

js
async function canvasFingerprint() {
  const canvas = document.createElement('canvas');
  canvas.width = 240;
  canvas.height = 60;
  const ctx = canvas.getContext('2d');
  ctx.textBaseline = 'top';
  ctx.font = '16px Arial';
  ctx.fillStyle = '#f60';
  ctx.fillRect(100, 5, 80, 30);
  ctx.fillStyle = '#069';
  ctx.fillText('Fingerprint test 123', 4, 20);
  const bytes = new TextEncoder().encode(canvas.toDataURL());
  const digest = await crypto.subtle.digest('SHA-256', bytes);
  return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, '0')).join('');
}

WebGL and audio fingerprints follow the same idea: render something fixed and measure the small differences the hardware and software stack introduce. crypto.subtle only works on HTTPS pages.

How accurate is browser fingerprinting?

Accuracy depends on two properties that pull against each other. Uniqueness is how few other browsers share the same values. Stability is how long the values stay the same for one browser. Adding more attributes makes a fingerprint more unique and less stable, because every extra attribute is one more thing that changes when the browser updates, a monitor is plugged in or the user travels to another time zone.

Desktop computers vary a lot in screens, fonts and graphics hardware. Phones vary much less: many people own the same iPhone model on the same iOS version with the same default settings, and their fingerprints look alike. For that reason, production systems match fingerprints with tolerance for small changes and combine them with other signals instead of trusting one exact hash. A fingerprint identifies a browser setup on a device. Several people can share a laptop, and one person can use three browsers. You can see what your own browser exposes with the EFF's Cover Your Tracks.

How is fingerprinting used in bot detection?

Ad tracking wants to recognise the same person across sites. Bot detection uses fingerprints for different jobs:

  • A browser that claims to be Safari on an iPhone but exposes a Chromium-only API, or claims Windows but has only Linux fonts and a software graphics renderer, is lying about itself. Headless browser detection is built largely on these checks.
  • When one device fingerprint appears behind dozens of signups or bonus claims, those accounts probably belong to one operator. This is the core of detecting multi-accounting.
  • One fingerprint seen from hundreds of IP addresses in an hour points to a bot rotating through proxies.

Fraud tools called antidetect browsers give each account a different, believable fingerprint, so a new hash on its own proves little. The consistency checks in the first point are what expose them.

How do browsers limit fingerprinting?

Browser makers treat fingerprinting as a privacy problem and reduce it in different ways. Safari limits some values and, with its Advanced Fingerprinting Protection, adds noise to APIs such as canvas. Firefox blocks scripts from known fingerprinting companies in its Enhanced Tracking Protection, and its "resist fingerprinting" mode, used by Tor Browser, makes many users report the same values. Brave randomises some outputs per site and per session.

People who use these browsers produce fingerprints that are uncommon or change between visits. A randomised canvas is a sign of a privacy setting, so it should not count as evidence of a bot by itself. False positives in bot detection covers how to keep these users out of your block lists.

In the EU, Article 5(3) of the ePrivacy Directive covers reading information from a user's device as well as setting cookies. The European Data Protection Board's Guidelines 2/2023 build on earlier regulator opinions that treat fingerprinting as falling within that scope. Access needs consent unless an exemption applies, such as being strictly necessary for a service the user asked for, and national regulators differ on how far security and fraud prevention fit that exemption. When a fingerprint can single out a person, the GDPR applies to it as personal data. The answer depends on the country and the purpose, and this page is not legal advice. Bot protection and GDPR goes through the main questions, and device fingerprinting vs browser fingerprinting explains how the two terms differ.

Common questions

What is the difference between browser fingerprinting and cookies?

A cookie is an identifier the site stores in the browser and reads back later, so the user can delete it. A fingerprint is computed again on each visit from what the browser exposes, so clearing cookies does not change it, though a browser update or a new monitor can.

What is browser fingerprinting used for?

The two main uses are advertising and analytics tracking, and security: fraud prevention, bot detection and recognising a returning device at login. The same technique raises different legal questions depending on which of these it serves.

Can a website see my fingerprint without JavaScript?

Partly. Headers such as the User-Agent, Accept-Language and client hints, the IP address and the TLS handshake reach the server on every request. Canvas, WebGL, fonts and most hardware values need JavaScript.