This story has been updated. It was originally published on May 18, 2017.

Disaster has struck—an unwanted piece of malware has taken root on your computer. So what’s your next step? While you shouldn’t underestimate the potential damage viruses can cause, you might be able to get your computer back on its feet without too much difficulty, thanks to an array of helpful tools.

We’re using the term malware to refer to all kinds of computer nasties, whether they’re viruses, ransomware, adware, or something else. Each of these threats have their own definitions, but the terms are often used interchangeably and can mean different things to different people. So for simplicity’s sake, when we say malware, we mean everything you don’t want on your computer, from a virus that tries to delete your files to an adware program that’s tracking your web browsing.

With so many types of malware and so many different system setups out there, we can’t cover every scenario. But we can give you some general pointers to get you on your way to the help you need.

What to do first

The first step is realizing you have a problem. When malware hits, you sometimes get a threatening error message—but sometimes you don’t. So keep an eye out for red flags, such as a system that’s slowing to a crawl, a web browser inundated by endless pop-ups, and applications that just keep crashing.

Most machines have some kind of antivirus security protection, even if it’s just the Windows Defender tool built into Windows 10. Extra security software isn’t as essential on macOS—its integrated defenses are very effective—but that doesn’t mean a clever bit of malware can’t get access.

Windows Defender, antivirus protection for Windows computers.
Windows Defender offers competent basic malware protection for Windows 10 users. David Nield

If you do have a security tool installed, make sure you keep it up to date. Then, when you suspect you’ve been hit, run a thorough system scan. Not sure how? The app itself should have instructions for how to run a scan. This is always the first step in weeding out malware and viruses.

[Related: How to make sure no one is spying on your computer]

You might find that your installed security software spots the problem and effectively removes it on its own. In that case, you can get on with watching Netflix or checking your email without further interference. Unfortunately, if your antivirus software of choice doesn’t see anything wrong or can’t deal with what it’s found, you’ll have more work to do.

Deal with specific threats

If your computer is displaying specific symptoms—such as a message with a particular error code or a threatening ransomware alert—run a web search to get more information. And if you suspect your main machine is infected and potentially causing problems with your web browser, you should search for answers on your phone or another computer.

Telling you to search online for help may seem like we’re trying to pass the buck. But this is often the best way to deal with the biggest and newest threats. To get rid of a bug that overwhelmed your computer’s built-in virus protections, you’ll probably need to follow specific instructions. Otherwise, you could inadvertently make the situation worse.

As soon as new threats are identified, security firms are quick to publish fixes and tools. This means it’s important to stay in touch with the latest tech news as it happens. If your existing antivirus program is coming up blank, check online to see if companies have released bespoke repair tools that you can use to deal with whatever problem you’re having.

Finally, based on what your research and antivirus scans tell you, consider disconnecting your computer from the internet to stop malware from spreading or shutting down your machine completely to protect against file damage.

Try on-demand tools

At this point, you’ve scanned your computer for malware using your normal security software and done some research into what might be happening. If you’ve still got a problem, or your searches are coming up blank, you can find on-demand malware scanners online. These programs don’t require much in the way of installation, and they can act as useful “second opinions” to your existing anti-malware apps.

Tools such as Microsoft Safety Scanner, Spybot Search and Destroy, Bitdefender Virus Scanner (also for macOS), Kaspersky Security Scan, Avira PC Cleaner, Malwarebytes, and others can parachute onto your system for extra support. There, they’ll troubleshoot problems and give your existing security tools a helping hand.

Microsoft Safety Scanner, an antivirus program.
On-demand scanners, like Microsoft Safety Scanner, take another pass at your applications and files. David Nield

Another reason to use extra software is that whatever nasty code has taken root on your system might be stopping your regular security tools from working properly. It could even be blocking your access to the web. In the latter case, you should use another computer to download one of these on-demand programs onto a USB stick, then transfer the software over to the machine you’re having problems with.

[Related: How to safely find out what’s on a mysterious USB device]

All of the apps listed above will do a thorough job of scanning your computer and cleaning up any bad actors they find. To make extra-sure, you can always run scans from a couple of different tools. If your computer has been infected, these apps will most likely be able to spot the problem and deal with it, or at least give you further instructions.

Once your existing security tools and an on-demand scanner or two have given your system a clean bill of health, you’re probably (though not definitely) in the clear. That means that any continued errors or crashes could be due to other factors—anything from a badly installed update to a failing hard drive.

Delete and reset

Once you’ve exhausted the security-software solutions, you still have a couple of other options. One possibility: Hunt through your installed apps and browser extensions and uninstall any you don’t recognize or need. The problem with this method is that you could accidentally delete a piece of software that turns out to be vital. So, if you go down this route, make sure to do extra research online to figure out whether or not the apps and add-ons you’re looking at seem trustworthy.

A more drastic—but extremely effective—course of action is to wipe your computer, reinstall your operating system, and start again from scratch. Although this will delete all your personal files, it should hopefully erase malware and other unwanted programs at the same time. Before you take this step, make sure all your important files and folders are backed up somewhere else, and ensure that you’ll be able to download all your applications again.

The options for reinstalling Windows 10.
Resetting and reinstalling your operating system is always an option, but it could blitz your files as well as any malware. David Nield

Reinstalling the operating system and getting your computer back to its factory condition is actually much easier than it used to be. Microsoft has instructions for Windows and Apple has instructions for macOS. If you need more pointers, you can find plenty of extra information online.

That’s it! Through a combination of bespoke removal methods, existing security software, on-demand scanners, and (if necessary) a system wipe, you should now have effectively removed whatever problem had taken root on your system. At this point, if you’re still struggling, it’s time to call in the experts. Local IT repair specialists in your area may be able to lend a hand.

Prevent future problems

Proactively protecting your computer against malware is a whole ‘nother story, but here’s a quick run-down of the basics. Be careful with the links and attachments you open and the files you allow on your computer. Remember that most viruses and malware will find their way to your computer through your email or web browser, so make sure you use some common sense and are cautious about what you click on and download. You should also take care to keep your online accounts safe and secure.

Next, install a solid security tool you can trust. For Windows 10, the built-in Windows Defender program is a competent antivirus tool even if you don’t add anything else. That said, you can opt to bolster your machine’s defenses by paying for extra software from the likes of Norton, Avast, and many others. While the number of shady programs targeting Apple computers is on the rise, they’re still more secure than Windows machines. The general consensus is that macOS is mostly safe from harm, provided you only install programs through the App Store and apply plenty of common sense. That means you should avoid following shady links or plugging in strange USB drives you’ve found lying in the street.

Finally, make sure your software is always patched and up to date. Most browsers and operating systems will update automatically in the background, but you can check for pending patches in Windows by opening Settings and clicking Update & security. On a macOS computer, just open up the App Store and switch to the Updates tab to see if anything is available that you haven’t downloaded.

It’s difficult to give a prescriptive setup for every system and every user, but you should always remember that 100 percent effective protection is hard to guarantee. Always stay on your guard.