Navigator: deviceMemory property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The deviceMemory read-only property of the Navigator interface returns the approximate amount of device memory in gigabytes.

The reported value is imprecise to curtail fingerprinting. It's approximated by rounding the actual memory to the nearest power of 2, then dividing that number by 1024. It is then clamped within lower and upper bounds to protect the privacy of owners of very low-memory or high-memory devices. These bounds may change over time (see browser compatibility table).

Value

A floating point number coarsened to a power of two value, clamped to implement-defined limits.

For example, if a browser does not report below 2 or above 32 then the value is one of: 2, 4, 8, 16, 32.

Examples

js
const memory = navigator.deviceMemory;
console.log(`This device approximately ${memory}GiB of RAM.`);

Specifications

Specification
Device Memory API
# sec-device-memory-js-api

Browser compatibility

desktop mobile server
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Node.js
deviceMemory
Chrome – Full support
Chrome 63 (Release date: 2017-12-06)
footnote
footnote From Chrome 147, reported values are 2, 4, 8, 16, and 32.
footnote Before Chrome 147, reported values were 0.25, 0.5, 1, 2, 4, and 8.
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote
footnote From Edge 147, reported values are 2, 4, 8, 16, and 32.
footnote Before Edge 147, reported values were 0.25, 0.5, 1, 2, 4, and 8.
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 50 (Release date: 2018-01-04)
footnote
footnote From Opera 131, reported values are 2, 4, 8, 16, and 32.
footnote Before Opera 131, reported values were 0.25, 0.5, 1, 2, 4, and 8.
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 63 (Release date: 2017-12-05)
footnote
footnote From Chrome 147, reported values are 1, 2, 4, and 8.
footnote Before Chrome 147, reported values were 0.25, 0.5, 1, 2, 4, and 8.
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 46 (Release date: 2018-05-14)
footnote
footnote From Chrome 147, reported values are 1, 2, 4, and 8.
footnote Before Chrome 147, reported values were 0.25, 0.5, 1, 2, 4, and 8.
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 8 (Release date: 2018-07-18)
footnote
footnote From Chrome 147, reported values are 1, 2, 4, and 8.
footnote Before Chrome 147, reported values were 0.25, 0.5, 1, 2, 4, and 8.
WebView Android – Full support
WebView Android 63 (Release date: 2017-12-05)
footnote
footnote From Chrome 147, reported values are 1, 2, 4, and 8.
footnote Before Chrome 147, reported values were 0.25, 0.5, 1, 2, 4, and 8.
WebView on iOS – No support
WebView on iOS
footnote No support
Node.js – No support
Node.js
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
See implementation notes.

See also