Here's Apples list of options.My wife's iPhone 6 is doing the same kind of dance as what Alf describes here. It can go from a full charge one minute to a low charge the next and then shut off. Or just shut off when showing a 60% charge.
Is this a sign that the battery is bad and needs to be replaced?
My iPhone 6 purchased at the same time is working just fine.
If it's a 5 or a 6s, it might be a recalled unit.