> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Prolong Laptop Battery Life in Linux by Limiting Charging Levels
- URL: https://itsfoss.com/limit-battery-charging-linux/
- Published: 2025-03-11T12:50:25.000Z
- Updated: 2026-07-01T10:04:52.000Z
- Description: Prolong your laptop's battery life in long run by limiting the charging to 80%.
- Author: Abhishek Prakash
- Tags: Tips 💡

In case you didn't know it already, regularly charging the battery to 100% or fully discharging it puts your battery at stress and may lead to poor battery life in long run.

I am not making claims on my own. This is what the experts and even the computer manufactures tell you. 

As you can see in the official Lenovo video above, continuous full charging and discharging accelerate the deterioration of battery health. They also tell you that the optimum battery charging range is 20-80%.

![Optimum Battery Charge](https://itsfoss.com/content/images/2025/03/Optimum-battery-charge.png)

Although Lenovo also tells you that battery these days are made to last longer than your computer. Not sure what's their idea of an average computer lifespan, I would prefer to keep the battery life healthy for a longer period and thus extract a good performance from my laptop as long as it lives.

I mean, it's all about following the best practices, right?

Now, you could manually plug and unplug the power cord but it won't work if you are connected to a docking station or use a modern monitor to power your laptop. 

What can you do in that case? Well, to control the battery charging on Linux, you have a few options:

- KDE Plasma has this as an in-built feature. That's why KDE is ❤️
- GNOME has extensions for this. Typical GNOME thing.
- There are command line tools to limit battery charging levels. Typical Linux thing 😍

🚧

Please note that not all devices support this feature. In some cases, you may also need to change power settings at the BIOS level. In simpler words, things may or may not work easily, depending on the laptop you are using.

Let's see them one by one.

📋

Please verify [which desktop environment you are using](https://itsfoss.com/find-desktop-environment/) and then follow the appropriate method.

## Limit laptop battery charging in KDE

If you are using KDE Plasma desktop environment, all you have to do is to open the Settings app and go to Power Management. In the Advanced Power Settings, you'll see the battery levels settings.

I like that KDE informs the users about reduced battery life due to overcharging. It even sets the charging levels at 50-90% by default. 

![Setting Battery charging limit in Linux distros with KDE Plasma](https://itsfoss.com/content/images/2025/03/battery-charge-setting-kde-1.png)

Of course, you can change the limit to something like 20-80\. Although, I am not a fan of the lower 20% limit and I prefer 40-80% instead.

![Set battery charging limit in KDE Plasma](https://itsfoss.com/content/images/2025/03/battery-charge-80-40.png)

That's KDE for you. Always caring for its kusers.

💡

It is possible that the battery charging control feature may need to be enabled from the BIOS. Look for it under power management settings in BIOS.

## Set battery charging limit in GNOME

Like most other things, GNOME users can achieve this by using a GNOME extension.

There is an extension called [Battery Health Charging](https://extensions.gnome.org/extension/5724/battery-health-charging/?ref=itsfoss.com) that is compatible with several laptop manufacturers, from Asus to LG and from Dell to Lenovo.

Still, not all models from these brands will be supported. So please [refer to the compatibility info on its GitHub repo](https://maniacx.github.io/Battery-Health-Charging/device-compatibility?ref=itsfoss.com).

I have a detailed tutorial on [using GNOME Extensions](https://itsfoss.com/gnome-shell-extensions/), so I won't repeat the steps.

Use the [Extension Manager tool](https://flathub.org/apps/com.mattjakeman.ExtensionManager?ref=itsfoss.com) to install the Battery Health Charging extension. 

As soon as it is installed, you should see a notification about enabling Polkit so that the extension can run with escalated privilege.

![Escalated privilge for battery charging threshold on Linux](https://itsfoss.com/content/images/2025/03/battery-health-extension-polkit-settings-1.png)

Once that is enabled, you can find the extension in the system tray. It has three modes:

- Full capacity mode
- Balanced mode
- Maximum lifespan mode

All three modes can accept values between certain limits. You can set that from extension settings. And you can choose which mode you want to use from the system tray.

![Configuring Battery Health Threshold extension on GNOME](https://itsfoss.com/content/images/2025/03/battery-health-extension-1.png)

Click to enlarge

There are some additional settings and you can explore them if you want.

## Using command line to set battery charging thresholds

🚧

You must have [basic knowledge of the Linux command line](https://courses.linuxhandbook.com/courses/linux-for-devops/?ref=itsfoss.com). That's because there are many moving parts and variables for this part.

Here's the thing. For most laptops, there should be file(s) to control battery charging in `/sys/class/power_supply/BAT0/` directory but the file names are not standard. It could be `charge_control_end_threshold` or `charge_stop_threshold` or something similar.

Also, you may have more than one battery. For most laptops, it will be BAT0 that is the main battery but you need to make sure of that.

Install the `upower` CLI tool on your distribution and then use this command:

```
upower --enumerate
```

It will show all the power devices present on the system:

```
/org/freedesktop/UPower/devices/battery_BAT0
/org/freedesktop/UPower/devices/line_power_AC0
/org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o001
/org/freedesktop/UPower/devices/line_power_ucsi_source_psy_USBC000o002
/org/freedesktop/UPower/devices/headphones_dev_BC_87_FA_23_77_B2
/org/freedesktop/UPower/devices/DisplayDevice
```

You can find the battery name here.

The next step is to look for the related file in `/sys/class/power_supply/BAT0/` directory.

If you find a file starting with `charge`, note down its name and then add the threshold value to it.

In my case, it is `/sys/class/power_supply/BAT0/charge_control_end_threshold`, so I set an upper threshold of 80 in this way:

```
echo 80 | sudo tee /sys/class/power_supply/BAT0/charge_control_end_threshold
```

You could also [use nano editor](https://itsfoss.com/nano-editor-guide/) to edit the file but [using tee command](https://linuxhandbook.com/tee-command/?ref=itsfoss.com) is quicker here.

The problem is that these settings won't persist after reboot. You'll need to add some sort of mechanism so that it runs on each boot.

If [you are using systemd](https://itsfoss.com/check-if-systemd/), you can [create a systemd service](https://linuxhandbook.com/create-systemd-services/?ref=itsfoss.com).

Create a new file `/etc/systemd/system/battery-threshold.service`:

```
sudo nano /etc/systemd/system/battery-threshold.service
```

And add the following lines to it if you are setting the threshold at 80 for `BAT0`:

```
[Unit]
Description=Set battery charging threshold
After=multi-user.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

[Service]
Type=oneshot
ExecStart=/bin/bash -c 'echo 80 > /sys/class/power_supply/BAT0/charge_control_end_threshold'

[Install]
WantedBy=multi-user.target suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
```

Save the file and enable the service:

```
sudo systemctl enable battery-threshold.service
```

It should work now for setting battery charging limit automatically in each session. Thanks to [this GitHub repo](https://github.com/sreejithag/battery-charging-limiter-linux/tree/main?ref=itsfoss.com).

💡

You can also [use tlp](https://linrunner.de/tlp/settings/battery.html?ref=itsfoss.com) for this purpose by editing the `/etc/tlp.conf` file.

[Subscribe to It's FOSS YouTube Channel](https://www.youtube.com/@itsfoss?ref=itsfoss.com)

## Conclusion

See, if you were getting 10 hours of average battery life on a new laptop, it is normal to expect it to be around 7-8 hours after two years. But if you leave it at full charge all the time, it may come down to 6 hours instead of 7-8 hours. The numbers are for example purpose.

This 20-80% range is what the industry recommends these days. On my Samsung Galaxy smartphone, there is a "Battery protection" setting to stop charging the device after 80% of the charge.

I wish a healthy battery life for your laptop 💻