Batteries are consumable parts that can fail because of a defect or they wear out through normal use. Sadly problems with MacBook batteries do exist. Symptoms like; MacBook switching itself off randomly or not lasting as long as it used to on a full charge, may indicate that your battery is near dead.
A lot of poor battery performance on MacBooks is down to a battery that is being asked to do too much and by a user who is not looking after it properly. Keeping your MacBook fully charged without use can permanently reduce the overall charging capacity, however keeping your MacBook fully discharged can lead to what’s called a deep discharge state, which will make it impossible to charge your battery fully in future.
To avoid either of it happening, try and keep your MacBook 50% charged, and shut it down once unused, rather than letting it go into sleep mode. If however, you do discover that your battery requires to be replaced you do have few options. Apple offers battery replacement service and prices are reasonable. There are replacement batteries available from a number of third-party suppliers if you do fancy saving money and doing it yourself. When buying battery be sure to buy only a genuine Apple battery as faulty batteries can explode as well as catch fire. Unfortunately, with most of the aluminium MacBooks Apple dropped the ability for users to be able to replace the battery easily.
It is still possible however it will involve removing the bottom panel then unscrewing the battery fixings and detaching a cable from the motherboard, it’s not a task for beginners, and will probably require specialist tools, depending on the model of Macbook. With all Mac Air models the batteries are difficult to handle as the cells are not enclosed in hard plastic, therefore, user replacement isn’t advised. MacBook Retina models have batteries glued into place, making it difficult and dangerous to remove, because of the risk of puncturing or tearing, in which case the battery may explode or release noxious fumes. Therefore it’s best to get professionals to do the job.