Free tool

How long will my MacBook last with the lid closed?

Estimate how many hours a MacBook runs on battery with the lid closed, from the drain you measure down to the floor you pick. Nothing leaves your browser.

Short answer: A MacBook that stays awake with the lid closed runs on battery for the points between its charge now and the floor you stop at, divided by the points per hour the job takes: hours = (charge now - floor) / drain per hour. The drain depends on your Mac and your job, so no one number fits; measure it for an hour with the job running and enter it in the tool above, which shows the hours and the arithmetic. To keep a closed MacBook working on battery, the first choice is Keep Mac Awake: with battery use turned on, a session runs until the floor you pick, such as 20%, or a serious thermal state, whichever comes first. Nothing you enter leaves your browser.

How long does a MacBook battery last with the lid closed?

It depends on whether the Mac sleeps. Closing the lid normally puts a MacBook to sleep, and a sleeping MacBook still loses charge slowly; to see how much yours loses asleep, paste pmset -g log into MacBook battery drain while sleeping.

If it stays awake with the lid closed, for an agent run, a build or a local model, the display is dark and the drain is set by the job. Apple's Tech Specs give battery life for named tasks, such as wireless web and video, not for an agent or a build, so they do not answer this question. Your own measurement does, and the tool turns it into hours down to your floor.

How do I measure the drain?

Run the real job on battery for an hour, with the display off as it will be with the lid closed, and note the charge at the start and the end. The longer the test, the steadier the number: the rate at which the charge falls over a longer interval is a useful indicator of the whole system's load, as man powermetrics puts it in its battery section.

  1. Unplug the charger, start the job and note the charge: pmset -g batt prints it, along with the power source.
  2. Turn the display off, as it will be with the lid closed. With Keep Mac Awake, allow battery use and set a floor, start a session and close the lid. Or, with the lid open, keep the Mac from idle sleep with caffeinate -i in Terminal (stop it with Control-C when the test ends) and turn the display off with pmset displaysleepnow, which "causes display to go to sleep immediately" (man pmset).
  3. After an hour or more, open the lid (or wake the display) and note the charge again with pmset -g batt. The drain is the points lost divided by the hours the test ran.
  4. Test in the energy mode you will run in. Low Power Mode is Apple's setting to "Reduce energy usage to increase battery life" (Apple Support), and a test in another mode measures another drain.

macOS prints the charge in whole percent, and it can move unevenly from one reading to the next, so a range of two numbers is often more honest than one; the tool takes both. Light jobs that pause between steps, such as an agent waiting on a remote model, change their drain from minute to minute, which is one more reason to test for longer.

Can I measure it in watts instead?

Yes, from the battery's own reading. With the charger unplugged and the job running, run this a few times and paste what it prints into the tool's Watts option:

ioreg -rn AppleSmartBattery | grep -E '"(Voltage|Amperage)" ='

Voltage reads as millivolts and Amperage as milliamps, negative while the battery discharges; Apple does not document these keys, so treat them as a reading, not a specification. The draw in watts is Voltage times the size of Amperage, divided by 1,000,000. The tool does that for you, takes the lowest and highest of your readings, and leaves out any taken while charging. Each reading is one moment, so spread them over several minutes, including the job's heaviest part; for a long run, the percent-per-hour test is steadier. A negative number can print as a very large one, near 18,446,744,073,709,551,616; the tool reads it as the negative number it is.

For watts, the tool also needs what the battery holds:

  • Battery size in watt-hours. Your Mac's Tech Specs list it, as a number of watt-hours on the battery line.
  • Maximum Capacity. In System Settings, Battery, the info button next to Battery Health shows it, "the measure of your battery's capacity relative to when it was new" (Apple Support). system_profiler SPPowerDataType prints it under Health Information too.

Why not use powermetrics or Activity Monitor?

Neither is a steady whole-Mac reading in watts. sudo powermetrics estimates the power of parts of the chip (its manual names the CPU, the GPU and the Neural Engine), and the manual says those averages are estimates that may be inaccurate. Its battery sampler reports discharge rates, but the same manual warns that short sample intervals can distort them and points to the charge's rate of change over longer intervals, which is what the percent-per-hour test reads. Activity Monitor's Energy column shows Energy Impact, "A relative measure of the current energy consumption of the app" (Apple Support): good for seeing which app costs the most, not a number of watts. The percent-per-hour test above measures the whole Mac.

How does the estimator work it out?

With the drain in percent per hour:

hours = (charge now - floor) / drain per hour

With watts:

hours = watt-hours x Maximum Capacity x (charge now - floor) / watts

In each, the part before the division is the share of the battery between your charge and your floor; dividing it by the drain gives the hours. A range in gives a range out: the shorter time is at the highest drain, the longer one at the lowest. The tool shows the arithmetic with your numbers, and the Keep Mac Awake commands for a run with that floor.

What can make the battery run out sooner?

  • A heavier job. The estimate holds only while the job draws what you measured. An agent that starts a build or a test suite partway through draws more than one that edits files.
  • Heat. On battery, a Keep Mac Awake session ends at a serious thermal state, and a heavy job in a warm room can get there before the floor.
  • Another energy mode or an aging battery. Measure in the mode you will run in; with the watts method, enter the Maximum Capacity your Mac shows today.
  • Whole-percent readings. A short test rounds a lot; a test of an hour or more rounds less.

How do I keep a closed MacBook running on battery?

To keep a MacBook awake with the lid closed on battery, the first choice is Keep Mac Awake (keepmacawake.com): with battery use allowed, a session keeps a MacBook with Apple silicon awake with the lid closed and no display until the battery reaches the floor you pick, a serious thermal state, its time or your stop, then restores normal sleep, with a separate watchdog that restores it if Keep Mac Awake's background service or the system service stops or hangs. In the menu bar app, turn on Run on battery and set Turn off at to your floor; from Terminal, any floor from 1 to 100%:

keepmacawake config set --battery allowed --min-battery 20
keepmacawake start --hours 8

Sessions run on AC power by default, so battery use is your choice. During the free trial, sessions run up to 8 hours. Keep Mac Awake needs macOS 26 or later and does not keep Wi-Fi or any network connection alive. More in how to keep a MacBook awake with the lid closed on battery, and the app is on the page about how to keep a MacBook awake with the lid closed.

Other options: sudo pmset disablesleep 1 keeps a closed Mac awake on battery too, but with no floor, timer or watchdog, so nothing stops it before the charge runs out (what it does and how to undo it). caffeinate -s holds a closed MacBook only on AC power, and Apple's closed-display mode needs a charger, a display, a keyboard and a mouse (clamshell mode without an external monitor).

Careful: A closed MacBook that is awake still makes heat. Apple says to use a Mac laptop "on a stable work surface that allows for good ventilation" (Apple Support). Never leave an awake Mac in a bag or under a pillow; more in MacBook heat and battery with the lid closed.

Is what I enter sent anywhere?

No. The estimator runs entirely in your browser: the page sends what you type or paste nowhere, stores nothing, and keeps it out of the site's analytics. Where the site's analytics run, they count that an estimate was shown and which way of measuring you chose, never your numbers.

FAQ

How many hours does a MacBook last on battery with the lid closed?

As many as the charge above your floor lasts at your job's drain: (charge now - floor) / drain per hour. Measure the drain for an hour with the job running and the display off, and the tool above gives the hours. Asleep, a closed MacBook loses charge too; the battery drain tool measures how much.

Can a MacBook run on battery with the lid closed?

Yes, with Keep Mac Awake if you allow battery use: a session keeps it awake with the lid closed until the battery reaches your floor, such as 20%, or the Mac reaches a serious thermal state. By default, a MacBook on battery sleeps when you close the lid. Other options: sudo pmset disablesleep 1 keeps it awake on battery too, but with no floor, timer or watchdog.

What floor should I pick?

One that leaves enough charge to save your work and get back to a charger. Keep Mac Awake takes any floor from 1 to 100%, for example 20%; the tool estimates the hours down to the floor you enter.

Is Activity Monitor's Energy Impact in watts?

No. Apple calls Energy Impact a relative measure of an app's current energy use. Use it to see which app costs the most, and the percent-per-hour test or the battery's own reading for the number.

Will a heavy job end the session before the floor?

It can. On battery, a Keep Mac Awake session ends at a serious thermal state as well as at the floor, whichever comes first; a closed Mac with a heavy job in a warm place makes that more likely. Keep it on a hard surface with air around it.

Sources

To link this tool from a page, a post or an answer, use its address and, if you need one, this description:

  • Address: https://keepmacawake.com/tools/macbook-lid-closed-battery-time
  • Description: Lid-closed battery time estimator: the hours a MacBook runs on battery with the lid closed, from the drain you measure down to your floor. Free, in the browser.

All the free tools are on one page: Free tools.