If you're having trouble with your laptop, such as not detecting the battery, restarting the device may be a good idea. Give it a try and see if the issue persists. Additionally, make sure to keep your laptop in cool and dry environments. Hot and humid weather can put extra strain on batteries and reduce their lifespan over time. Manufacturers like Dell and Lenovo have been working on smart battery technology for years, which allows the battery to track its usage throughout the day to prevent overcharging.
Batteries don't like heat, and when they exceed 100 degrees, a chemical process begins. If your laptop is easy to open (i.e., it has simple screws on the bottom of the chassis), you can remove the bottom cover and check the physical condition of the battery. Replace it if it's worn out or drained, and if your laptop allows you to do so.
A given laptop batteryis composed of several individual cells, and problems can arise in one or more of them. It's usually better to buy a replacement from the original laptop manufacturer than a cheaper compatible option from a third party.
However, lithium-ion batteries have their limits, and with modern laptops becoming more powerful than ever, we're relying on them for longer periods of time. Laptops are lasting longer than ever before, so battery swelling due to overuse is becoming increasingly common. The accessibility of batteries in modern laptops (i.e., the ability to open up the case and replace the battery) varies greatly. You'll often find that laptop batteries are described as four- or six-cell batteries, which indicates their internal structure. Most laptops are built differently on the inside with slight variations, and some simply come with batteries that aren't replaceable because the chassis is designed not to open.
Manufacturers test their batteries to last up to three or four years, but in reality, batteries degrade over time. With Apple MacBooks, some Windows ultrabooks (especially some of Microsoft's Surface Laptop models) and some Chromebooks, there are sometimes batteries that you can't access to replace them. If you start seeing signs that the battery is damaged, swollen or dead (in which case it only holds a charge for a short period of time), replace it as soon as possible instead of waiting. The size of a swollen battery can range from a small bump to one large enough to rock the laptop or even push out the touchpad.