So this is probably a rather simple question but electrical circuits are not my forte. I have been curious about how devices, specifically a laptop, can seamlessly switch between AC wall power (plugged in) and battery power?

This has been on my mind after doing some research on Lithium ion batteries and their lifespan in laptops. Some folks say that when plugged in, the laptop is using power through the battery and simply constantly charging it between that 90% and 100% range as it goes. Now this seems rather detrimental for the lifespan of the battery, so I can't imagine that most laptops are actually doing this. In my mind the simplest solution is just running completely on the AC wall power and leaving the battery alone when it is fully charged. So the question lies in how does the laptop switch from using AC wall power to using the battery, without shutting down for that split second when you unplug the machine from the wall power adapter?

My expertise is in the software realm, so I am rather ignorant on how the actual electrical engineering works in these cases. My simple guess was that a capacitor(s) supplies the power during that short time when switching between power sources. So, could anyone please explain how this actually works? Feel free to be as technical as you'd like. I have an engineering mindset, so I find the low level details interesting.

Thanks! Also, if this is a duplicate question, feel free to close or remove it and link the answered thread. I did some searching and didn't come across a similar enough thread.

  • \$\begingroup\$ You can think of the battery as a giant capacitor. If it provides sufficient cushion for load changes when the external supply is not connected, it will provide sufficient cushion when the external supply is connected. \$\endgroup\$ Mar 13, 2020 at 22:30
  • \$\begingroup\$ you cannot charge and discharge a battery at the same time ... the current cannot flow in opposite directions simultaneously \$\endgroup\$
    – jsotola
    Mar 14, 2020 at 0:26

4 Answers 4


So the question lies in how does the laptop switch from using AC wall power to using the battery, without shutting down for that split second when you unplug the machine from the wall power adapter?

Short answer: very fast controls.

There are many ways of implementing this functionality, but on modern (circa 2020) motherboards this is done by means of a dedicated charger IC that controls when power should come from the AC wall power or from the battery by connecting/disconnecting the battery by means of a MOSFET between the battery and the rest of the motherboard. ISL9238 Example Schematic

The example schematic above comes from the ISL9238 datasheet. This IC measures the AC input voltage (which is DC by the time it arrives to this IC) and if present, uses that input to power the motherboard + charge the battery. Otherwise the IC switches to powering the system from the battery only, and the switching occurs within a few microseconds.

During that small n-microsecond window the decoupling capacitors on the board hold enough charge to power the motherboard. And should these capacitors, for some reason, be not enough to power the motherboard during the switching period, the body-diode of the series MOSFET will conduct until the IC fully switches on the MOSFET.

There are other operating modes available from this IC (such as battery supplemental mode), but that's outside the scope of this question.

There's a whole world of charger ICs out there that do this: the ISL9238 is just one of them. Checkout Digikey's Battery Chargers section if you're curious to learn more.

  • \$\begingroup\$ Thanks, this was what I was really curious about. The switch between power sources without shutting the machine down. \$\endgroup\$
    – jdewerth
    Mar 15, 2020 at 0:46

A number of laptops work just as you describe, and it is in fact very rough on the batteries. Not only charging to 100%, but just sitting idle at 100%, stresses a lithium cell.

Some charging systems divert input power separately to battery and load when plugged in. This is a better system, because it gives more control over the battery current (since it can be measured separately from the load current). However, this doesn't solve the problem of sitting idle at full charge.

For this reason, some laptops have a BIOS option to charge the battery to only 80%. Some studies have shown that keeping the battery between 20% and 80% can increase battery life by an order of magnitude as opposed to running down to 0 and charging to 100.

Charge levels below 20% are also disproportionately stressful to batteries.

  • \$\begingroup\$ So if that is the case, I assume that at least some power is always being drawn from the battery ? Then when the AC wall power is unplugged, the components can just draw more power from the battery ? My laptop will pull over 150w when plugged in and under load, so I can't imagine that is always drawn from the battery. \$\endgroup\$
    – jdewerth
    Mar 13, 2020 at 20:15
  • \$\begingroup\$ @jandrew While the battery may be connected, the charger will be supplying the power, not the battery. \$\endgroup\$ Mar 14, 2020 at 3:07
  • \$\begingroup\$ @jandrew That 150W is probably enough to run your laptop at full tilt while also charging the battery. When plugged in, both are important. Have you tested how much power it pulls maximum when the battery is completely charged? \$\endgroup\$ Mar 16, 2020 at 12:26
  • \$\begingroup\$ @CristobolPolychronopolis Haven't tested it at differing charge levels yet. The GPU in this laptop can pull a max 115w and the CPU can pull like 55w under a combined load. It definitely takes longer to charge fully when also doing an intensive task. I'll give it a shot sometime. \$\endgroup\$
    – jdewerth
    Mar 16, 2020 at 18:26

The battery and power supply schematics for laptops are very complex. When the laptop is connected to the AC mains power supply, the voltage presented by that unit is provided to both the internal switching power supplies AND the internal battery charger unit. The battery will have FET switches or at minimum be diode isolated on the output so that a laptop running on it's AC power supply IS NOT connected to the battery at all. Diode isolation is rarely ever used because of the Vf/power problem, FET switches or so called Active Diodes get used.

To charge (and know the state of) the battery is a complex task. Most laptops will show a percentage charge for the battery while on mains power, and this requires that the battery be isolated from the main internal power supply DC-DC converters. Figuring out the state of charge for the battery involves a complex voltage monitoring or power state IC embedded in the battery pack.

If you put some thought into the operational characteristics of a laptop you might think of:

  1. The battery voltage is not the same as the external power supply voltage, and typically a down converter would be used. Most typical laptops have a 19V (or thereabout) input level.

  2. Most laptop battery (LiIon) packs are 4 cells, so the maximum voltage will be about 16.8V. This allows a reasonable voltage drop (a buck charger) from 19V.

  3. Virtually all laptops have a screen indicator for the state of charge, and this would be almost impossible to calculate if the laptop was drawing power from both the external PS and the battery.


That's easy. It's like your car.

The laptop is always connected to the battery and can always draw from it.

Meanwhile, the "alternator" (Power block in this case) is injecting power into the system.

In your car, the alternator is tuned to output exactly the float voltage of your battery, so current flows in until it's fully charged, then battery current just stops. All alternator output goes into car's systems. This is dialed in well enough that cars can use SLA batteries such as Optima Red-tops.

In your laptop, largely the same thing happens, but the laptop battery is also guarded by a protective circuit which impedes current flow that would risk or damage the battery. So nothing is left to chance. The protective circuits stop current flow if that is needed.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.