This story has been updated. It was originally published on May 2, 2018.

You push the power switch to turn on your computer… and nothing happens. Even in this worst-case scenario, you can work through a number of troubleshooting options—so don’t panic yet.

When your desktop or laptop refuses to start, that means either the hardware or the software is having trouble. Identifying the problem’s root cause isn’t an exact science, but if you troubleshoot with a methodical approach, you can rule out many potential issues one by one.

In this guide, we’ll walk you through the steps you’ll need to get a non-starting computer up and running again. We’ll also explain when it might be best to call in the professionals. If all else fails, we’ll tell you how to retrieve your data from a dead device.

Before we begin, you should be aware that there’s a very, very long list of reasons why your computer might not start. So finding and fixing the problem often involves a lot of trial and error. We may not be able to include every potential issue, but we can guide you toward solutions for some of the most common problems.

Check for hardware problems

Begin by checking for issues with your hardware. First, make sure your computer really is powered off. For most makes and models, you can hold down the power button for a couple seconds to shut down the machine. Then, before attempting to turn it back on, unplug all unnecessary peripherals, such as printers and scanners, to make sure they aren’t causing interference.

Next, ensure that your machine is receiving enough power. If you’re dealing with a laptop, plug it in and ensure that the charging light is on. For a desktop, double-check that the monitor is firmly connected. On any type of computer, make sure you’re using the power cable that came with your laptop or desktop—or, if the original broke, that you have an exact replacement. If you own (or can borrow) a spare cable, try switching to that one to make sure it’s not the cause of the problem.

Once you’ve shut everything down, briefly push the power button to turn the machine back on. If your computer springs to life, at least for a few seconds, the culprit is probably damaged software… but this response doesn’t entirely rule out a hardware issue. So look for any messages on screen that might hint at what’s going wrong. Does the computer give a reason why it can’t boot? Is it unable to detect the hard drive or another specific component?

[Related: How to slow down a hot computer]

If the power button gets no response at all, it’s a tell-tale sign that something has gone wrong with the hardware. In this situation, if you’ve already tried that alternative power cable, it might be time to visit a local repair shop for a professional assessment.

Is it possible to pin down the exact hardware issue? We can’t cover every scenario here, but if you own an older computer, or have recently moved your machine around, you may have damaged or dislodged a component. With a desktop computer, you can try powering down the machine, opening up the case, and double-checking all the connections to and from the motherboard. But we’d only recommend that step if you’re confident poking around your computer’s guts. For the rest of us, a professional assessment is probably better.

In general, one of the most common causes of hardware failure is a dying hard drive. If your computer has been making strange noises, such as the sound of constant disk access, a high-pitched whirring, or a warning beep, this might be your problem. An on-screen message about disk trouble can also point to the same issue. Again, replacing your hard drive is a job for your local repair or retail store. Although disk-replacement is a relatively straightforward task—it involves disconnecting power and data cables from the existing drive and plugging them into the new one—there’s a lot of potential for mistakes if you’re not entirely sure what you’re doing.

However, if your computer does wake up for a bit, particularly if it gets as far as the loading screen for the operating system, then you’re more likely to be facing a software problem. We’ll cover those now.

Deal with software issues: Windows

When software refuses to let a computer start up, it’s usually because of data corruption: The system can’t find a file it relies on to boot up properly. If you’re lucky, you’ll see a message on screen explaining what’s wrong, along with instructions on what to do next. Otherwise, you’ll have to walk through some troubleshooting steps to pin down the problem.

On a Windows machine, the computer can try to fix itself. If it fails to start up three times in a row, Windows 10 automatically displays a recovery console, called Automatic Repair, on screen. When it appears, click Restart, and the system will attempt a number of fixes. This might be enough to get you back up and running.

However, if you try to start up after that and land back on Automatic Repair instead of your usual Windows desktop, click Advanced options > Startup Settings. Here, choose Restart, and you’ll see a list of boot up options. Hit 4 or F4 on your keyboard to choose Enable Safe Mode. This will launch a stripped-down version of Windows, with only the essential applications and utilities enabled. You may be able to launch Windows in this minimal state. If so, try uninstalling any programs or devices you’ve recently added, as they could be interfering with system startup.

If you can’t launch even this simple version of Windows, try a system reset: Open Settings (via the cog icon on the Start menu) and click Update & Security > Recovery. Under Reset this PC, select Get started to begin the reset process. Windows will then replace and repair many of the key operating system files. It will also offer to wipe your personal files as well, but unless you have extremely up-to-date backups, you should opt to keep them. This final measure should fix most software-related boot-up issues. However, if your computer still doesn’t start, the culprit is probably the hardware. As mentioned in the previous section, we recommend that you turn to the experts for help fixing this type of error.

Deal with software issues: macOS

The macOS operating system typically does a better job of repairing itself than the Windows one does (although Windows has caught up a little in recent years). That said, software corruption is still very much a possibility.

As an analog to Windows’ Automatic Repair, macOS has Recovery Mode. To use it, first determine if your device uses Apple silicon or an Intel processor. If it’s the former, press and hold the power button to turn on your Mac until a list of startup options appears. Click Options, then Continue. If it’s the latter, turn on your computer and immediately hold down Cmd+R until you see an image.

When the computer loads, you’ll see a list of options. Start with Disk Utility, which will scan your Mac’s internal drives for problems. It will also attempt to fix any issues it encounters, which might get your computer working properly again.

[Related: 4 hidden Mac tweaks to speed up your computer]

If your boot-up problems started after a recent hardware or software change, you may be able to fix them by returning to an earlier version of your software: From the Recovery Mode screen, try restoring from a Time Machine backup. Alternatively, a stripped-down version of the operating system could still work. For this method, you’ll need to use macOS Safe Mode.

To launch Safe Mode on an Apple silicon device, turn it off, then press the power button to turn it on and hold it until the startup options appear. Choose your startup disk, then press and hold Shift until you click Continue in Safe Mode. On Intel machines, restart your computer, then immediately press and hold Shift until the login screen appears.

If you can get into macOS via Safe Mode, a normal restart might fix your problem. If not, try uninstalling any non-essential applications or devices—particularly anything you set up around the time your startup problems began.

If you’re still having issues, you might need a full reinstall. Go back to the Recovery Mode screen and choose Reinstall macOS. This will completely restore your machine’s software back to its factory state, so only do this if you’ve backed up all your important data. Like the equivalent Windows process, a reinstall should fix most software problems.

Recover your data from the hard drive

Even if all these attempts fail, your precious data may still be safe (unless the primary cause of your startup troubles is a damaged hard drive). Of course, in an ideal world, you won’t need to retrieve that data, because you’ve already backed up all your files. However, if you don’t have available backups, you’ll want to pull your data from your hard drive.

On the simplest level, you can remove the drive from your laptop or desktop and access it from another computer. For example, you could set it up as an external drive, but to do that, you’ll need an enclosure like the models from Inateck ($10 on Amazon) or Sabrent ($10 on Amazon). Just make sure to purchase one that matches the hard drive you’re extracting from your old machine.

Once you have an enclosure, you’ll need to power down your computer, remove the side or bottom panel, and disconnect the drive from its enclosure and cables. You’ll want to follow an online guide, which you can find by searching for your computer’s make and model along with the phrase “remove hard drive. If you’re not exactly comfortable working on hardware, we recommend that you leave this task to a professional repair shop.

When you set up your old drive in a new enclosure, you can plug it in to a working machine, where it should appear as a normal external disk. If your original files are Mac ones, you’ll need to access them from another Apple computer, but if you don’t have one, a program like MacDrive ($50 with a free trial) will let you access them on Windows (Windows drives are much more accommodating, so you won’t need extra software to read them on a Mac). Then you can copy the files to the new computer—and make sure to back them up this time.

Try other data-recovery methods

Another option for retrieving your data is to access it through a different operating system. However, this will only work in situations where your computer can actually power up for long enough for you to boot from a portable system.

First, set up a portable Linux operating system on a USB stick (full instructions here). Pop that into your dead computer, start up on the Linux operating system, and try to access the drive that way.

However, if you want to get as much data as possible off your drive, and you’re prepared to pay for this peace of mind, you should get help from a data recovery service. A quick web search should turn up plenty of options in your local area.

Most professionals will accept the entire computer, or the the drive alone, wrapped in protective packaging. They’ll use the same techniques we’ve already discussed to access your data—but the staff have probably attempted it many more times than you have, and thus have a better chance of extracting your information and dealing with any problems that arise.