Your phone showed about 30% left, then shut off suddenly outdoors. Back inside, you turn it on and the charge is back. This can be a temporary effect of cold, or a sign the battery needs replacing. The checks below, in order, separate the two.
1. Does it return to normal somewhere warm?
Apple's temperature guide for iPhone says iPhone and iPad are designed for ambient temperatures of 0–35°C. The same page says using them in very cold conditions outside that range can "temporarily shorten battery life and cause the device to turn off," and that it returns to normal when brought somewhere warmer. Samsung's Galaxy battery guide likewise says that in very cold environments the battery's internal resistance rises temporarily and voltage drops more sharply, so the phone may power off to protect components. Once the battery returns to normal temperature, internal resistance returns to normal too.
So if the charge reads normally after the phone warms up indoors and it works as usual afterwards, treat it first as a temporary cold effect.
2. Was the charge low when it shut off?
Cold is not the only factor. Apple's iPhone battery and performance page explains that battery impedance (internal resistance) "temporarily increases with a low state of charge and in a cold temperature environment." Drawing a sudden high load from a high-impedance battery drops the voltage further, and if minimum voltage cannot be maintained the phone shuts down to protect its electronics. The same page says such shutdowns can occur more often with a low charge, an older battery, or low ambient temperature.
If it went off on a cold day at low charge while you opened a power-hungry feature like the camera, this is the case. If it also shuts off indoors or with plenty of charge, go to the next step.
3. Check aging on the battery health screen
Samsung's same guide states that "shutdowns can occur in aged batteries, especially in low-temperature environments or in winter, and may become more frequent depending on the level of aging." How to check depends on the phone.
- iPhone: Settings → Battery → Battery Health. If the peak performance section says "This iPhone has experienced an unexpected shutdown because the battery was unable to deliver the necessary peak power," performance management is already active. If it says "Your battery's health is significantly degraded," Apple recommends replacement at an authorized service provider.
- Galaxy: Samsung Members app → Get help → Phone diagnostics → Battery status. Samsung advises a service-center check if the phone often shuts off or battery time has dropped sharply.
According to Apple, performance management caused by low charge or cold is temporary, but it may persist on a heavily aged battery. Apple says replacing the battery can help if you are affected.
4. When it will not charge in the cold
After a shutdown, plugging in may not charge the phone. Apple says a device that is too cold may not charge or may stop charging. If the lock screen shows a "Charging On Hold" notice, charging resumes automatically when the temperature returns to normal. Samsung's charging guide also says charging may stop to protect the device if low or high temperatures persist, and recommends charging at room temperature. Before suspecting the charger or cable, let the phone warm to room temperature and reconnect.
When these checks are not enough
If it shuts off even when warm and well charged, and battery status reads normal, neither cold nor battery aging explains it. Have it checked at a service center. Apple's battery care page says reduced battery life in very cold conditions returns to normal once the battery is back in its normal operating range. The condition under which the same page warns battery lifespan may be permanently shortened is using or charging above 35°C ambient. The storage range, -20–45°C, is in the iPhone temperature guide cited above.