files/en-us/web/api/device_memory_api/index.md
{{DefaultAPISidebar("Device Memory API")}}{{securecontext_header}}{{AvailableInWorkers}}
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 {{DOMxRef("Navigator.deviceMemory")}} or {{DOMxRef("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.
{{Specifications}}
{{Compat}}