Issue with 2018 macbook pro - eviltoast

Hi, I have a 2018 macbook pro. A few days ago i went to use it and it said the battery was dead. I was confused because thought it had a good bit of battery when I went to sleep the night prior. I plugged it in turned it on and to my surprise said it had 49% battery remaining. All was well for two days but then today the same thing happened wouldn’t turn on plugged it in for like 2 minutes and then boom 42% battery remaining and runs fine unplugged. Does anyone have any clue what could be the issue?