Today, computers are used everyday and everywhere. For many, they work without any failures, and for many, the opposite is true. And the most frustrating is the fact that the PC suddenly shuts down during operation, and all the data it is currently processing is lost in most cases.
Computer turns itself off due to software part
Sometimes it's normal for a PC to shut down without user interaction. First of all, you need to pay attention to what time the computer turns off by itself. If this happens, for example, at night when you are not using it, then it is possible that some program is installed that disables it. If this happens after some time (5, 10, 15 minutes, etc.) after you stop using the computer, then your operating system is most likely doing this in order to save energy.

All of the above can not be called problems - it is rather the wrong settings. But if this does not apply to your PC, then you need to check the system for infectionvirus. The operating system can also be the culprit. If any system files, settings, etc. have been deleted or changed, then the easiest way to fix the situation is to reinstall the OS. It is worth noting that programs infrequently cause the computer to turn itself off. Most often this happens due to the fault of the equipment.
Computer turns itself off due to hardware failures

As you know, if the PC is completely turned off, it means the loss of electricity in it. Therefore, the first thing you should pay attention to is the power supply. First, you need to check its power (usually indicated on the sticker). If, for example, it is 300 W, and the sum of the powers of all devices that are currently connected to the PC is the same or more than this value, then the computer itself turns off precisely for this reason. It is not recommended that this figure reach a high mark. The computer will shut down because the power supplies have overload protection. In this case, you can try disconnecting some devices (up to USB) and see if the power goes off.
There is another unpleasant reason why the computer restarts or shuts down completely - overheating of any PC element. The power supply itself, the processor, the south or north bridge, etc. can overheat. To determine this, you can use one of the special utilities, such as Everest Ultimate. The program immediately upon startup will showthe temperature of a particular device (however, the power supply will have to be checked manually). For most elements, a temperature of 100 degrees is already critical, and when they heat up to this mark, the self-defense system is activated, and the computer turns off by itself.

Heating does not occur immediately. Its speed depends on the temperature of the room, as well as on the efficiency of the cooling devices. These are the ones you need to check. Here you should immediately pay attention to the speed of their rotation - you may have to lubricate the coolers with oil or even replace them.
But there are frequent cases when all of the above problems are not present in the PC: the operating system is normal and not infected with viruses, the coolers rotate properly and the elements do not overheat, but still the computer turns off by itself. In such a situation, workshops can help: maybe some individual element is not working properly, suddenly stopping its functioning, due to which the entire device stops working.