Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The capabilities of a client device largely depend on the amount of available RAM. Traditionally, developers had to use heuristics and either benchmark a device or infer device capabilities based on other factors like the device manufacturer or User Agent strings.
There are two ways to determine the approximate amount of RAM a device has: use the Device Memory JavaScript API or accept Client Hints.
You may query the approximate amount of RAM a device has by retrieving Navigator.deviceMemory or WorkerNavigator.deviceMemory.
const RAM = navigator.deviceMemory;
You may also use the Client Hints HTTP Header with the Device-Memory directive to retrieve the same approximate RAM capacity.
Returns the approximate amount of device memory in gigabytes.
Returns the approximate amount of device memory in gigabytes.
| Specification |
|---|
| Device Memory> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
Device_Memory_API |
63 | 79 | No | 50 | No | 63 | No | 46 | No | 8.0 | 63 | No |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
Device_Memory_API |
65 | 79 | No | 52 | No | 65 | No | 47 | No | 9.0 | 65 | No |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
Device_Memory_API |
61 | 79 | No | 48 | No | 61 | No | 45 | No | 8.0 | 61 | No |
Device-Memory header
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Device_Memory_API