A battery's runtime depends on what the laptop is doing, how bright the screen is and the power mode, so a single hours figure only holds for one load.
- A browser can read the charge level and whether the battery is charging, in Chrome and Edge, and nothing else: no watts, no wear, no design capacity.
- The battery drain test records the level against time under a load you choose and gives percent an hour, from the moments the level changed. It needs at least 10 minutes, because the level moves in 1% steps.
- Any runtime from that rate is a straight line, and batteries do not drain in one. The test labels its runtime an estimate, and so should anyone.
The short answer
Measure the drain under the load you care about, then divide. Unplug, keep the screen brightness and power mode as you use them, run the load for long enough that the level falls several steps, and read percent an hour. The battery drain test does the timing and the arithmetic, and keeps the estimate apart from the measurement.
We have no recorded runs of this test in our validation notes yet, so this guide quotes no measured results. Every line and constant below is the one the test's code applies.
How the rate is worked out
The browser reports the level rounded, in practice to 1%. Taking the first and last readings would carry up to a step of error at each end, so the test uses the moments the level changed: from the first change to the last there is a whole number of steps. It reads the level every 5 seconds as well as on the browser's change events, and shows a rate only after 10 minutes and enough changes. Those are our starting values.
A worked example, not a run: a level that falls one step every 6 minutes from 80% reaches 70% after an hour. The first change comes at 6 minutes and the last at 60, 9 steps in 54 minutes, which is 10.0% an hour, between 8.9 and 11.1 allowing one step of rounding either way. At that rate the estimate from full is 10 h 00 min, and from 70% it is 7 h 00 min.
The three loads
The test runs one of three loads the page starts and stops itself: idle: the page does nothing but read the level; video: a clip decoded and drawn at 30 frames a second; processor: every core but one kept busy by workers. None fetches anything, so the network is not part of the figure. Pick the one closest to your use, or run each in turn on a full charge.
Why the runtime is an estimate
- Batteries do not drain in a straight line, and systems hold back the last few percent.
- Brightness, background work and the power mode change the rate while the test runs.
- Browsers slow pages that are hidden, so the test reports how long the page was hidden and the load was lighter then.
- The rate holds for this load. A game, a video call or a compile will drain at its own rate.
Terms used here
Questions
- Can a website tell my battery's health or wear level?
- No. The Battery Status API gives only the level and whether it is charging. Wear needs the design and full-charge capacity, which the operating system reports: on Windows, powercfg /batteryreport writes both.
- Why does the test stop when I plug in?
- A rate is only a drain rate while the battery is draining. Charging, even briefly, breaks the staircase the rate is worked out from, so the test asks you to unplug and start again.