How to Check if a File Has a Virus Before Downloading
As a software developer and cybersecurity consultant with over 20 years of experience, I‘ve helped countless clients deal with the aftermath of a malware infection. And in the vast majority of cases, it all started with the simple act of downloading a file from the internet.
It‘s a lesson I‘ve learned the hard way myself. Years ago, I accidentally downloaded an infected spreadsheet from an email that appeared to be from a trusted colleague. I had antivirus software installed, but it failed to detect this new variant. That one little file led to a massive headache – my computer was overwhelmed with pop-up ads, my personal data was stolen, and I had to spend days cleaning up the mess.
Don‘t let this happen to you! In this guide, I‘ll share my best tips and tools for checking files for viruses BEFORE you download them to your Mac or PC. I‘ll cover how online virus scanners work, which file types carry the most risk, and proactive steps you can take to avoid dangerous downloads in the first place. Let‘s get started.
The Prevalence of Malware in Downloads
First, let‘s look at some statistics to underscore the importance of pre-screening downloads for viruses. According to AV-TEST Institute, an independent malware research lab, over 450,000 new malicious programs and potentially unwanted applications are discovered every day. In total, they‘ve collected over 1.2 billion malware samples as of 2022.
Malicious downloads are one of the most common delivery methods for this malware. A recent study by the University of Michigan found that 8% of websites contain drive-by-download attacks that can stealthily install malware if a user simply visits the page. And approximately half of the top 90,000 websites have hosted malware at some point, according to research from security firm Websense.
Types of files most likely to be infected include:
| File Type | % Containing Malware |
|---|---|
| .exe (executables) | 30.01% |
| .doc (Word docs) | 22.44% |
| .xls (Excel sheets) | 10.77% |
| .zip (compressed archives) | 9.21% |
| .pdf (PDF documents) | 8.21% |
Source: Symantec‘s 2020 Internet Security Threat Report
These numbers show that malware is rampant in all corners of the web and a wide variety of common file formats. Cybercriminals are constantly coming up with new ways to trick users into downloading infected files. That‘s why it‘s critical to check EVERY file you download for viruses, even if it appears to be from a legitimate website or sender.
How Online Virus Scanners Work
Online virus scanners like VirusTotal are a quick and easy way to check a suspicious file before opening it. These scanners allow you to upload a file (or enter the URL/hash of a file) and scan it with dozens of different antimalware engines simultaneously.
Here‘s a high-level overview of how a service like VirusTotal works behind the scenes:
- When you submit a file, it gets uploaded to VirusTotal‘s servers and added to a queue for analysis.
- The file is then passed through over 70 independent scanning engines from various cybersecurity vendors (Microsoft, McAfee, Kaspersky, etc).
- Each engine checks the file‘s code against its database of known malware "signatures" and heuristics that flag suspicious behaviors. They may also run the file in a sandbox to analyze its activities.
- If an engine detects signs of malware, it flags the file as malicious and categorizes the threat (virus, worm, Trojan, etc.)
- After all the engines have scanned the file, VirusTotal compiles the results. You‘ll see the total number of engines that flagged the file as malicious and their specific threat categorizations.
- If a file is malicious, VirusTotal will prevent you from downloading it directly from their interface. You can still download the original file from the source, but at least you‘ll be armed with knowledge that it‘s likely dangerous.
The whole process typically takes less than a minute, which is pretty remarkable when you consider how many different scanning engines are involved behind the scenes. Online scanners draw on the combined knowledge bases of dozens cybersecurity companies to provide a fast "second opinion" on a file‘s safety before you run it.

Of course, no malware detection method is foolproof. New zero-day exploits can sometimes slip through the cracks of signature-based scanning initially. Some sophisticated malware can also employ techniques to detect and evade scanning environments.
That‘s why online scanning should be used in combination with other methods like local antivirus, proactive download habits, and plain old common sense. Don‘t rely on VirusTotal or any single tool as your sole layer of defense.
Dangers Lurking in Common File Types
As the prevalence statistics showed earlier, virtually any type of file can potentially contain malicious code. But some formats are significantly "riskier" than others in terms of likelihood of infection and potential for damage. Let‘s look at a few of the most dangerous file types.
Executables (.exe, .bat, etc)
![]()
Executable files pose the greatest risk because their sole purpose is to execute code on your machine. Upon opening a .exe, any malicious scripts bundled inside will immediately start running and can infect core system files or download additional malware from a botnet.
Adware, spyware, ransomware, and all sorts of other nastiness tends to propagate via executable downloads. The same goes for .msi, .bat, .com, and other executable extensions. Be EXTREMELY cautious about opening any unfamiliar executable file, especially if it arrived via email or download.
Office Documents (.doc, .xls, etc)
Microsoft Word documents, Excel spreadsheets, and PowerPoint presentations can contain dangerous macro scripts. When opened, those macros can automatically execute and infect your system with malware, usually by exploiting vulnerabilities in Microsoft Office itself.
Malicious macros are often spread via phishing emails that spoof brands or trick users with social engineering tactics. An attachment may claim to be an invoice, report, or receipt that requires you to "enable macros" to view it properly. Don‘t fall for it!

Fortunately, Microsoft has been cracking down on macro-based attacks in recent years. In the latest versions of Office, macros are disabled by default and will only run if you manually enable them for a document. But it‘s still all too easy for unsuspecting users to turn macros on and shoot themselves in the foot.
PDF Files
Compared to executable and Office files, PDFs may seem relatively safe. Adobe has put a lot of work into locking down its PDF standard and reader software to prevent exploits. But there are still some sneaky ways that a cleverly-crafted PDF can infect your machine with malicious code.
PDFs can contain code-based widgets and forms that connect to the internet when opened. A hacker could use malicious JavaScripts or forms to trigger a drive-by download that silently installs malware.
Cybercriminals also like to use PDFs as a vehicle for phishing – a PDF attachment may contain a fake "error" message that instructs users to click a malicious link. The PDF format also allows embedded .exe or .zip files, which is another common tactic for tricking users into downloading an infected "document."
Archives (.zip, .rar, .iso, etc)
This one catches a lot of people off guard. Compressed file archives like .zip, .rar, and disk image files like .iso seem like they should be safe – after all they are just collections of other files, right?
The problem is that the contents of an archive are not fully visible or individually scannable until the whole archive has been downloaded and extracted, giving any malicious contents a chance to execute. It‘s easy for hackers to bundle malware or infected files among legitimate contents in an archive and rely on human error to run them.
Archives are also often used to smuggle malicious files past email filters and antivirus software that might normally flag them. An executable that gets blocked as an attachment might get through if it‘s hidden inside a .zip instead. So even if your email provider says an archive attachment is clean, be cautious about extracting and opening the contents.
Spotting Suspicious File Downloads
Of course, the best way to avoid malware is to steer clear of suspicious downloads in the first place. With a little vigilance and common sense, you can spot many risky files and links without even scanning them. Here are some red flags to watch for:
- Unsolicited email attachments: Never open an attachment from an unknown, unexpected, or poorly-worded email, even if it looks like a document. It‘s most likely malware.
- Unofficial software/media downloads: Avoid downloading cracked versions of paid software, pirated movies/music, key generators, "free" versions of paid assets, etc. These are often bundled with malware by hackers.
- Popups and fake download buttons: Be careful when downloading from file sharing sites like Rapidgator or Mega. They often display fake "Download" ads and popups that lead to malware instead of the real file.
- Shortened or misspelled URLs: Hover over hyperlinks before clicking them, especially short links from bit.ly or similar services. Make sure the destination URL goes to the site you expect. Also watch for subtle misspellings or variants of popular domains.
- Unfamiliar or unsafe file extensions: Be very wary of executable formats like .exe, .bat, .msi etc from unknown sources. Archives like .zip or .rar and Office files like .doc could also be risky. When in doubt, scan before opening!
Some other general tips to avoid risky downloads:
- Stick to official app stores, vendor sites, and reputable download portals.
- Keep your OS, browser, plugins, and antimalware software up-to-date.
- Use an ad-blocker to hide malicious popup ads and fake download buttons.
- Scan any file with antivirus software before opening, especially email attachments.
- Enable "protected view" for Office docs to stop macros from auto-executing.
- Don‘t download cracks, pirated media, or illegal software – it‘s not worth the risk!
If you suspect a file is malicious, don‘t open it! Submit it to VirusTotal or your antivirus software for scanning just to be safe. And if a file you already downloaded starts behaving strangely or triggers a malware alert, immediately disconnect from the internet to prevent the infection from spreading or "phoning home" to a hacker.
What to Do If You Suspect an Infection
So you‘ve scanned a suspicious file before opening it, but somehow some nasty malware still slipped through and now you think your Mac or PC may be infected. What do you do now?
First, don‘t panic. Modern malware may be highly sophisticated, but it‘s also treatable with the right tools and approach. Here are the key steps to take if you suspect your computer caught something:
- Disconnect from the network: As soon as you suspect an infection, unplug your Ethernet cable or disconnect from Wi-Fi. Some malware will try to spread itself to other devices on your network. You also don‘t want the malware communicating with its command and control center.
- Enter Safe Mode: Restart your computer in Safe Mode, which is a special diagnostic environment with most unnecessary services and programs disabled. In Safe Mode, malware that usually auto-starts will be disabled, making it easier to find and remove.
- On Windows: Press F8 while booting until the Boot Options menu appears, then select Safe Mode.
- On macOS: Hold Shift while booting until you see the login screen, then log in.
- Run a full virus scan: Open your antivirus program and start a full system scan (not just a quick scan). This may take a few hours, but it will methodically check every file on your hard drive for signs of infection. Delete or quarantine anything it flags as malicious.
- Check your browser and OS settings: Some sneaky malware will change your default browser homepage, search engine, or DNS settings to redirect you to dangerous sites. Check your settings and restore them to default if anything seems off.
- Monitor for unusual activity: Reboot your computer normally and keep a close eye on CPU usage, network activity, pop-up ads, or other strange behavior. If the symptoms persist, you may need to try a different anti-malware tool or consult an IT professional.
- Stay vigilant: Even if you‘ve cleaned up an infection, stay cautious about future downloads, email attachments, and internet activity. There‘s always new malware emerging in the wild. Keep your software updated and your guard up!
The key is to act quickly and isolate the infected machine to prevent the malware from propagating or causing more damage. With some proactive scanning and a watchful eye, you can stop most malware attacks in their tracks and avoid a catastrophe.
Closing Thoughts
Malware is a fact of life on today‘s internet, but that doesn‘t mean you have to live in fear of your computer getting infected every time you download a file. By making a habit of scanning unfamiliar files with tools like VirusTotal before opening them, you can weed out a huge portion of potential threats.
Combine pre-download scanning with other smart computing practices like keeping your software updated, using antivirus protection, blocking ads and popups, and avoiding the darker corners of the web. The more layers of defense you have, the less likely you are to experience the headache of an infection.
Remember, no single tool or practice is 100% foolproof – even I‘ve been caught off guard by a well-disguised virus once or twice. But don‘t let that stop you from being proactive. Keep educating yourself on the latest threats and prevention techniques. With vigilance and common sense, you can significantly reduce your malware risk and surf the web with confidence.
Stay safe out there!