DOMRect and getClientRects metrics
Measures element boxes at subpixel precision, including text, emoji and ranges.
In one line
Can measure text and emoji boxes to spot your fonts and system
Measures element boxes at subpixel precision, including text, emoji and ranges.
Sizes of text and emoji boxes depend on installed fonts, text shaping, zoom and OS, giving a hash that works even when canvas is blocked.
What it can and can't do
What the user does: Nothing. It happens when the page loads
It can
- Measure the size of hidden text and emoji down to tiny fractions
- Turn the sizes into a number that depends on your fonts, zoom and system
- Work even when canvas checks are blocked
It cannot
- Show you anything on the screen
- Know your name
- Ask permission first
- Give a clear result if the browser adds noise or rounds the sizes
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 2 | 2009-05-21 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 3 | 2008-06-17 | None |
| Safari | Supported | 4 | 2009-06-08 | None |
| Safari on iPhone | Supported | 3.2 | 2010-04-03 | None |
| Chrome on Android | Supported | 18 | 2012-06-27 | None |
| Samsung Internet | Supported | 1.0 | 2013-04-27 | None |
How a site asks for it
| API | element.getBoundingClientRect(); getClientRects(); Range.getClientRects() |
| Browser compat keys | api.Element.getClientRectsapi.Element.getBoundingClientRect |
| How access is granted | none |
| What the user sees | Not listed |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | Not listed |
| How to take it back | Not listed |
| Inside an iframe | Not listed |
Typical flow
- Insert off-screen elements with odd fonts and emoji
- Read rects with float precision
- Hash widths and heights
Data you get
What comes back: Floats with up to 10 decimal places per measurement
Shape: hash
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
width | float | CSS px | 0 to viewport | double precision |
Technical limits
- Deterministic per font and zoom stack, so entropy is bounded by fonts and DPR
The story
What it is
A script measures the exact size of text and boxes on the page, down to tiny fractions of a pixel.
For you
You see nothing. The page places invisible text, measures it, and the tiny numbers depend on your fonts, zoom and screen. Together they act like a fine detail fingerprint of your setup.
For makers
Layout code needs these numbers all the time, for menus, tooltips, drag and drop and animation. Trackers reuse the same call because tiny rounding differences reveal your system.
Where you see it
| Type | Example | Apps |
|---|---|---|
| productivity | A document editor like Google Docs measures text to decide where lines and pages break. | Google Docs |
| creative | A design tool such as Figma measures shapes and text boxes to snap them neatly to each other. | Figma |
| games | A browser game checks where UI boxes sit so a click lands on the right button. | None named |
| security | A fraud tool measures the same emoji at many sizes and compares to known real devices, to spot an emulator. | None named |
| ads | A tracker measures the same text across fonts and adds the result to a device ID. | None named |
| shopping | A product page measures a size chart to show a hover zoom exactly over the right part of the image. | None named |
| accessibility | A screen magnifier extension reads boxes to move focus accurately around a page. | None named |
Risks
- Reveals fonts and zoom level
- Hard to block without breaking layout
What the platform says
- MDN: getBoundingClientRect. Returns the size and position of an element, which sites use for layout, tooltips and animation.
Good uses and abuse
Legitimate uses
- None beyond layout
Known abuse
- Canvas fallback fingerprint, zoom and DPR detection
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 3 of 5 | How revealing the data is |
| Utility | 1 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 4 | Rough identifying entropy, when known |
Related capabilities
Related
- Font enumeration by text metrics. Can test hundreds of font names to learn which fonts are on your device
- SVG text metrics. Can measure picture text sizes to learn about your fonts and system
Sources
How well checked: Based on official documentation.