Why does my laptop turn off at 50% battery

My laptop is unexpectedly turning off when it reaches about around 50% battery, but the actual level can be anywhere between 40% and 60%. It never turns off when plugged in. Whenever it does shut off, I have to plug it in before it turns back on. I thought maybe something was wrong with the way the laptop was reading the battery, so I updated the BIOS. Right after updating, the computer reached 20% without turning off so I thought the problem was fixed. But the next time I used it, it shut down at 40% again.

I know its not a heat issue because it happens whenever the laptop isn't plugged in. I thought maybe my laptop is reading the battery wrong but I don't know how to fix it. I've already completely reinstalled Windows.