Open Command Prompt as administrator and type:
powercfg /batteryreport
Open the HTML file it saves and compare “Design capacity” with “Full charge capacity”. If the full charge capacity is a small fraction of the design capacity, or near zero, the battery is worn out. A report showing no battery at all, or errors, points the same way.
Try another matching charger if you can. Check that the plug and charging port are clean and undamaged. If the laptop runs fine on AC power, the charger is probably okay, since a bad charger usually causes shutdowns even when plugged in.
Run the manufacturer’s hardware test. Many have a built-in test: restart and tap F12, then choose Diagnostics. It reports battery health directly. For example, Surface devices have the Surface Diagnostic Toolkit.