Live Battery Status
Battery Level
โ
Detectingโฆ
Charging
โ
Time to Full
โ
Time Remaining
โ
Raw API Values
battery.level
โ
battery.charging
โ
battery.chargingTime
โ
battery.dischargingTime
โ
Battery Events Log
Events will appear here as your battery state changesโฆ
What Is the Browser Battery Status API?
A complete guide to how the Battery Status API works, what data it exposes, and why it matters for users and developers alike.
The Battery Status API Explained
The Battery Status API (officially Battery API) is a W3C web standard that allows websites to access real-time information about the host device's battery through JavaScript. It is exposed via navigator.getBattery(), which returns a Promise that resolves to a BatteryManager object. This object contains four live properties โ level, charging, chargingTime, and dischargingTime โ that update automatically as the device state changes, without any page refresh.
Why Would a Site Need Battery Data?
Web applications can use battery information to deliver smarter, more considerate user experiences. A video streaming platform can automatically reduce video quality or disable autoplay when the battery is critically low. A progressive web app can pause background sync jobs when the device is unplugged. A productivity tool can prompt the user to save work if the battery drops below 10%. This kind of battery-aware design reduces data usage, extends device battery life, and prevents the frustrating loss of unsaved work on low-charge devices.
Battery API vs. Native Apps
Native iOS and Android apps have always had access to detailed battery information through platform SDKs. The Battery Status API brings this same capability to the open web, enabling web apps to behave more like native apps. Unlike native apps, however, the web Battery API is sandboxed to the browser โ it can only read battery data passively and cannot control or manipulate device power settings. This makes it safer and privacy-respecting by design, though some browsers have restricted or removed it precisely because even read-only battery data can be misused for device fingerprinting.
Privacy Considerations
In 2015, security researchers demonstrated that battery.level and battery.dischargingTime together create a device fingerprint precise enough to re-identify users across websites โ even in private browsing mode. This prompted Mozilla to remove the Battery API from Firefox entirely in 2019. Safari on iOS has never implemented it. Chrome still supports the API on desktop and Android but may return rounded or artificial values. This is why our tool displays a "Not Supported" notice on browsers that have disabled or restricted it โ it is not a bug, but a deliberate privacy choice.
The Four Battery API Properties โ In Detail
Everything the BatteryManager object exposes: what each property means, its data type, and how to interpret its values.
battery.level โ Battery Charge Level
Type: Number (float between 0.0 and 1.0). Meaning: The current battery charge level expressed as a fraction. A value of 0.87 means the battery is at 87%. A value of 1.0 means fully charged. A value of 0.0 means completely empty. To display this as a percentage, multiply by 100: Math.round(battery.level * 100). The levelchange event fires each time this value changes. Some browsers round this to the nearest 5% or return exactly 1.0 when the battery is not present (e.g. desktop computers without a battery).
battery.charging โ Is the Device Charging?
Type: Boolean (true or false). Meaning: Indicates whether the device is currently connected to a power source and actively charging. true means the battery level is increasing or the battery is full and maintaining charge. false means the device is running on battery power alone. On desktop computers without a battery, this typically returns true permanently. The chargingchange event fires each time the user plugs or unplugs the charger.
battery.chargingTime โ Time Until Fully Charged
Type: Number (seconds). Meaning: The estimated number of seconds until the battery is fully charged. If the device is not charging, this value is Infinity. If the battery is already fully charged (level = 1.0), this value is 0. For example, a value of 3600 means approximately 1 hour until full. The accuracy of this estimate depends on the operating system's power management subsystem โ it is not calculated by the browser itself. The chargingtimechange event fires whenever this estimate changes.
battery.dischargingTime โ Time Until Empty
Type: Number (seconds). Meaning: The estimated number of seconds until the battery is completely discharged. If the device is currently charging, this value is Infinity. A value of 7200 means approximately 2 hours of battery life remaining. This estimate reflects current power consumption โ if you start running a GPU-intensive task, the estimated time will drop quickly. Desktop computers (which have no battery) also return Infinity here. The dischargingtimechange event fires whenever this value is recalculated.
Battery Status Events โ Real-Time Change Detection
The BatteryManager fires four events. Your application can listen to these to react instantly when battery state changes โ without polling.
Event
levelchange
Fires whenever battery.level changes. Typically fires once per percent of battery lost or gained. Attach with battery.addEventListener('levelchange', handler). Use this to update a battery indicator in your UI without polling.
Event
chargingchange
Fires when the user plugs in or unplugs the charger, toggling battery.charging between true and false. This is the most reliable event for triggering battery-aware behavior โ such as pausing background uploads when the charger is disconnected.
Event
chargingtimechange
Fires when the system updates the estimated time to full charge. This can happen frequently in the early stages of charging when the power management system is still learning the charge curve. The value transitions from Infinity (not charging) to a number (seconds) when a charger is connected.
Event
dischargingtimechange
Fires when the estimated time until empty is recalculated by the OS. This happens frequently during active use as power draw fluctuates. When a charger is connected the value returns to Infinity. When the charger is disconnected, the value returns a decreasing number of remaining seconds.
Browser & Device Support
The Battery Status API has uneven support across browsers and platforms. Here is the current state as of 2025.
| Browser / Platform | Support |
|---|---|
| Chrome (Desktop) | Supported |
| Chrome (Android) | Supported |
| Edge (Desktop) | Supported |
| Opera | Supported |
| Firefox | Removed |
| Safari (iOS / macOS) | Not Supported |
| Chrome (iOS) | Not Supported |
| Samsung Internet (Android) | Supported |
| Brave | Blocked |
Frequently Asked Questions
Common questions about battery testing, the Battery Status API, and device battery health.
Apple requires all browsers on iOS โ including Chrome and Firefox โ to use the WebKit rendering engine, which does not implement the Battery Status API. This is not a limitation of this tool; it is a platform-level restriction. Safari itself has never supported this API on any platform (iOS or macOS). If you want to test battery data using a browser on an Apple device, there is currently no way to do so through a web page. For accurate battery information on iPhone, go to Settings โ Battery, which shows battery health percentage, usage analytics, and charge status directly in iOS.
Infinity is JavaScript's built-in value for "not applicable" in a numeric context. For chargingTime, Infinity means the device is not currently charging โ so there is no finite time until it is "full." For dischargingTime, Infinity means the device is charging and therefore will not discharge, or it is a desktop without a battery. This tool displays Infinity as "N/A" in the UI for clarity. It is not an error โ it is the correct API response for the current device state.
No. The W3C Battery Status API is intentionally limited to four properties โ level, charging, chargingTime, and dischargingTime. It does not expose battery health percentage, battery capacity in mAh or Wh, cycle count, temperature, or voltage. These require deeper OS-level or hardware-level access that browsers deliberately restrict for security and privacy reasons. To check battery health on Windows, run powercfg /batteryreport in an admin Command Prompt. On macOS, hold Option and click the battery menu bar icon, or use System Information โ Power. On iPhone, go to Settings โ Battery โ Battery Health & Charging.
Yes, but the values will reflect the absence of a battery. On a desktop computer without a battery, the Battery API typically returns level: 1.0 (100%), charging: true, chargingTime: 0, and dischargingTime: Infinity. This is the OS's way of saying "always on AC power, no battery to track." The tool correctly shows these values โ they are not errors. If you see 100% charging on a desktop, that is the expected result.
The chargingTime and dischargingTime values come directly from the host operating system's power management subsystem โ the browser does not calculate them independently. Their accuracy matches whatever your OS estimates in the system tray or menu bar battery indicator. In practice, dischargingTime can fluctuate widely because it is based on the current rate of power draw, which changes second to second as you open new apps, increase screen brightness, or run intensive processes. Consider these estimates as approximate guides rather than precise countdowns. Charging time estimates tend to be more stable once the battery is past 80% (trickle-charge phase).
The Battery API is completely read-only. It cannot control the device's charging, drain the battery, or access any personal data such as contacts, files, or location. The only risk identified in research is that the combination of battery.level and battery.dischargingTime can be used as a weak device fingerprint โ meaning advertisers could potentially use it to identify your device across different websites. This is why privacy-first browsers (Firefox, Brave) have restricted or removed the API. Our tool does not store, transmit, or log any battery data โ everything runs locally in your browser.