Every computer is a carefully constructed jigsaw of hardware components and software programs, and a major error in either area of the system can cause it to turn off, apparently without reason. The conditions that create the shutdown can give you some clues as to the issues behind it -- if your computer always turns off when launching the same program, for example, it's likely that this program is specifically to blame.

Overheating Components

If any of the components inside your computer get too hot -- such as the hard drive, CPU or random access memory -- it can cause a system shutdown. Hardware devices get too hot when they're being overworked or when they aren't adequately cooled. To fix the issue you may have to install extra case fans or disable overclocking utilities that are running your system faster than it's designed to go. You can also try moving the computer to a cooler location and improving air flow around the case.

Failed Hardware

Malfunctioning hardware components can bring your computer system crashing down, as the motherboard won't know what other action to take. It can be difficult to pinpoint which part of the system is to blame in this scenario -- you may hear unnatural noises coming from the power supply unit or one of the hard drives, but if your computer's memory modules or processor are damaged they may not give much in the way of warning. A freeware diagnostics tool such as Speccy, CPU-Z or HDDScan may shed some light on the issue if you're using a Windows-based machine.

Software Issues

Corrupted files, damaged settings and missing code on the software side of your system can also bring things to a sudden halt. You may have a problem with either your operating system (more likely if the computer turns off without any programs running) or a specific application that you've installed (more likely if the computer frequently turns off when one particular program is running). Steps you can take to try and fix the problem include uninstalling and reinstalling individual applications or the operating system as a whole -- these processes replace any code that has been deleted or corrupted, as well as resetting the configuration files required for your computer to run smoothly.

Virus Infection

If your computer has been infected with a virus or spyware program, it can sometimes cause your computer to turn off without warning. Malware can also corrupt your installed applications and operating system, which is another possible cause of regular system shutdowns. Check your installed security software programs and make sure you are running the latest versions of each one, then run the most thorough scans available to look for issues. Downloading additional standalone scanners can help pick out problems your regular applications miss; Spybot Search & Destroy and Microsoft Safety Scanner are two reliable tools that are free to use.