If your MacBook battery won't charge, there are a few steps you can take to try and fix the issue. First, restart your Mac and try a different charger. If that doesn't work, let your Mac cool down and reset the SMC. You should also check the condition of the battery and reset your Mac to factory settings.
If your MacBook is old enough to have a removable battery, you can remove it and hold down the power key for 10 seconds before replacing it. It's also important to check the basics, such as that the electrical outlets are working properly and that there are no breaks in the cable or dark spots on its surface. If the cable is damaged, it's probably the cause of the problem. Be sure to check the ports to see if foreign objects or dust have accumulated and remove any residues with a toothpick.
Depending on which MacBook you have, use a MagSafe or USB-C cable to charge (modern MacBooks can use either). The method you follow to reset the battery of your MacBook, MacBook Pro or MacBook Air depends on how old your Mac is and whether it has an Intel chip or an Apple chip inside it. If your MacBook Pro or MacBook Air won't charge or the charger won't work, making everything work can be a race against the clock, as your battery dies.The age of your MacBook Pro or MacBook Air will play an important role in the method you follow to restore your laptop's battery. If all else fails, you may need to get your MacBook repaired.