Check device battery status, charging state, and estimated time
Real-time monitoring of device battery status
Plan activities based on remaining usage time
Adjust app performance based on battery status
Activate power saving mode when battery is low
The Battery API (Battery Status API) is a JavaScript API that allows web browsers to access a device's battery status. It lets you programmatically check battery level, charging state, time remaining until fully charged, and estimated time until the battery is depleted.
Chromium-based browsers such as Chrome, Edge, and Opera support the Battery API. Firefox supported it in the past but has since disabled it for privacy reasons, and Safari does not support it. Mobile Chrome also supports it.
The displayed battery information comes directly from the operating system to the browser, so it is highly accurate. However, the estimated time until fully charged or depleted is a calculated estimate based on current usage patterns, so it may differ from actual values.
Lowering screen brightness, closing unnecessary apps, and disabling Wi-Fi and Bluetooth are effective. Keeping the battery charge between 20–80% also helps with long-term battery health. Overcharging and full discharge both shorten lithium battery lifespan.
Battery status information is very useful in web app development. It allows optimizing user experience by automatically switching to power-saving mode when battery is low or limiting resource-intensive tasks like video playback and animations. This helps prevent unexpected battery drain during critical moments.
To maximize smartphone and laptop battery lifespan, it is better to keep the charge below 80% rather than always charging to 100%. Using and storing devices in high-temperature environments accelerates battery degradation and should be avoided. Regularly monitoring battery information helps detect early signs of battery issues.