How To Protect Your PC From Viruses and Malware

Learn how to avoid infecting your computer with malware with these online safety habits.
Last updated Dec 6, 2024
We receive compensation from the products and services mentioned in this story, but the opinions are the author's own. Compensation may impact where offers appear. We have not included all available products or offers. Learn more about how we make money and our editorial policies.

Viruses and malware can wreak havoc on your computer. The malicious files slow down your PC and interfere with web browsing, and some can even compromise sensitive data on your hard drive. To make matters worse, tens of thousands of new viruses, malware, and spyware files or applications are released onto the internet every single day. 

Consequently, chances are good that you may download or encounter a bad file at least once or twice. But as grim as the malware and virus situation seems, protecting your computer and preventing infections is not nearly as difficult as you might think. With a little planning and attention to detail, you can keep your PC virus and malware-free. Here are some best practices for preventing malware 

Best Basic Adblocker — Including YouTube Video Ads
4.9
Editorial Rating
Learn More
On Total Adblock's website
Ad Blocker
Total Adblock
Up to 80% off
  • Instantly blocks distracting ads on millions of websites, including Facebook and YouTube ads
  • Blocks third-party trackers to protect your privacy and information
  • Improves page load times and enables faster browsing

In this article
1. Turn on real-time monitoring
2. Scan thumb drives and hard drives
3. Avoid downloading pirated media
4. Double-check add-on software
How to avoid malware online

1. Turn on real-time monitoring

Besides safe surfing habits, the surest way to protect your PC from virus or malware infections is to install antivirus and anti-malware applications that constantly scan your web traffic and hard drives for threats.

Windows Security offers real-time protection, but the security feature will automatically turn off if you start using another antivirus program. 

Windows Security real-time protection Windows 11

However, one of the best aspects of Windows Security's free Microsoft Defender antivirus is that it can be used concurrently with a third-party antivirus. So Microsoft can still conduct periodic scans to support your digital protection, even if the security features are not enabled. But if you stop using another antivirus software, be sure to toggle real-time protection back on. 

Learn more about Windows Security settings in our guide.

Top-tested antivirus software with real-time protection

Antivirus
Star rating
4.7
4.8
4.8
Price $29.00–$49.00/yr (first year only) $29.99–$249.99/yr $29.99–$99.99/first yr
# of devices protected 4 - 8 Unlimited 1 - 10
Malware scans Manual and scheduled Manual and scheduled Manual and scheduled
Real-time protection
EICAR test results 2/3 3/3 3/3
Firewall
Phishing protection
Compatibility Windows, Mac, Android, iOS, Chrome, Edge, Opera, Safari Windows, Mac, Android, iOS, Chrome, Firefox, Safari, Edge Windows, Mac, Android, iOS
Extras Password manager, ad blocker, VPN Parental controls, performance optimization tools, VPN Password manager, VPN, dark web monitoring, parental controls, privacy monitor, identity theft protection, cloud backup
24/7 customer support
Learn more Get TotalAV Get McAfee Get Norton 360

2. Scan thumb drives and hard drives

Portable storage solutions such as USB flash drives and external hard drives make sharing files easier than ever. And there will probably be times you receive a storage device from a colleague, family member, or friend that contains files you need or simply want to transfer to your computer. After all, that is what the media was designed for: sharing files. 

But you should be extra cautious about files you receive on media from other sources.

When handing you a flash drive or other type of media, your friend or relative may unwittingly give you an unhealthy dose of viruses and malware for your computer. 

In most cases, this is certainly not intentional. However, if the other person had viruses or malware on the computer from which they transferred the files, the malicious applications could have easily propagated and nestled themselves in the external media.

Before you copy any files from external media to your PC, you should always scan them with a quality antivirus or anti-malware scanner. If you're lucky, the scanner program will detect infected files when you insert or connect the media. 

Even if it doesn't, though, perform a manual scan by opening Windows Explorer or File Explorer, right-clicking the drive letter for the external media, and selecting "Scan," "Scan This Drive," or another similarly named label. 

If there are viruses or malware files on the media, the scanner application should detect them and prompt you for their deletion or removal.

A screenshot showing the C: drive on a computer and the option to Scan with Malwarebytes Anti-Malware software selected

Are you tempted to use a free USB charging station? Learn how to protect against juice jacking in our guide.

3. Avoid downloading pirated media

Some of the largest sources of viruses and malware applications are file-sharing services that host pirated software, illegal files, and copyright-infringing music or videos. While downloading free copies of software or multimedia files may be tempting and seem like a good idea, doing so may put your computer and data at risk.

Hackers and unscrupulous developers are well aware of the temptation that offering free access to expensive music, programs, and videos provides many users. Consequently, they use that temptation to entice users to download infected copies of illegal files or media by offering free wares on file-sharing sites. 

Likewise, many torrent files contain malware and viruses installed alongside real applications. Downloading pirated programs and media is not only illegal, but it is also downright dangerous in many cases. So don't do it.

Learn how to torrent safely in our guide.

4. Double-check add-on software

Nowadays, it's common for software developers to bundle other programs in the setup routines or installers for their own applications. While some of these "bonus" applications are genuine, useful utilities, some are malware or spyware designed to steal data, consume your bandwidth, or engage in other forms of digital mischief. 

Therefore, you should always be wary of unknown applications bundled with programs you want to use. Better yet, try to find another source for the program setup file you want to install and see if you can find an installer without the add-on applications.

If you have to install an application from a setup package that includes add-on software, read all descriptions for the bonus applications carefully. Additionally, review the license agreements carefully, as you may be giving your permission to transmit sensitive data to developers simply by installing the programs. 

Before installing an add-on or bonus application, carefully research the program's name using your preferred search engine. This will help you determine whether the application is legitimate or simply malware or spyware in disguise. 

In most cases, you can select or deselect add-on programs to determine whether they install. If you have any doubts about an add-on program, deselect it and do not install the application. 

If the setup package does not allow deselecting add-on programs, stop and stay away from the application. If you can't find an installation source without the add-on programs, it's probably best to find another similar application.

Learn more about bloatware in our guide.

How to avoid malware online

The surest way to prevent your computer from becoming infected with malware or viruses is to surf smart. Surfing smart does not require you to learn anything new or be a technical expert; it simply means you must be wary of the sites you surf, the files you download, and the ads or pop-ups you click.

Before downloading a file or application, be sure it's from a well-known site you can trust. While many legitimate, lesser-known websites certainly exist, many malicious sites are just waiting to infect your PC with viruses or malware. 

One of the easiest ways to know whether you are visiting a reputable website is to install antivirus software with an anti-phishing or malicious website component. These applications generally do a good job of blocking access to rogue or malicious websites and warn you before accessing the bad site.

A screenshot of the Internet Explorer web browser alerting the user that there's a problem with the website's security certificate

Keep your browser up to date

Another way to avoid malicious websites is to update your browser to the latest version. When you update your browser, the list of known blacklisted and malicious websites updates as well. You can check for browser updates in the "About" or "Help" section.

A screenshot of the Chrome browser's About page showing that it's up to date.

Don't click on pop-ups or ads

Avoid clicking links to applications or "free online scans" in pop-up windows. Pop-up ads often contain links to malware applications disguised as legitimate programs and security scanners. Download security applications only from official sites or well-known download sites. 

Sites such as Download.com, Filepuma, and Softpedia are respected sites where you can find genuine application files scanned thoroughly for viruses and malware. 

Below are a few examples of pop-up windows with links to malware posing as antivirus applications.

A screenshot of several malicious pop-up ads posing as an antivirus alert

A screenshot of a malicious pop-up ad posing as an antivirus alert asking if the user wants to remove threats

Be wary of emails sent from unknown sources

Never open attachments in emails from people or organizations you do not know personally or professionally or with whom you haven't done business (i.e., downloaded books, purchased music, or applications). Doing so could lead to your email account getting hacked

Before opening emails, ensure you have a real-time antivirus program installed to flag phishing emails, filter spam emails, and scan messages and attachments for viruses and malware.

Online email sites such as Gmail, Yahoo Mail, and Outlook generally filter out spam and scan for viruses. Even still, do not open attachments in emails from sources you do not recognize. 

If you have any doubts about an email message, leave it unopened and research the source online. Better yet, delete the message from the unrecognized sender by sending it to the trashcan.

Learn more online safety tips in our guide.

No Fuss, Real-Time Online and Mobile Protection
4.7
Editorial Rating
Learn More
On TotalAV's website
Antivirus Software
TotalAV
First year discount on paid plans
  • Real-time protection from viruses, malware, and online threats
  • Blocks tracking cookies and ads, proactively monitors for data breaches, and option to schedule smart scans
  • 100% compatible with Windows, Mac, Android, and iOS operating systems on up to 3 devices
  • Lacks firewall protection