How to Scan a File for Malware

Before you open a download, an email attachment or a file someone sent you, you can check it for malware in under a minute. This guide covers the fastest free methods on any device, from a drag-and-drop online check to the antivirus already built into Windows.

Quickest option: drag the file onto the iMalware scanner. It computes the file's MD5 fingerprint inside your browser and checks it against 1,045,564 known malware hashes. Nothing is installed and the file is never uploaded.

Method 1: Scan a file online for free (no install, no upload)

  1. Open imalware.com in any modern browser on Windows, macOS, Linux, ChromeOS or Android.
  2. Drag the file onto the drop zone, or click it to pick the file.
  3. Your browser reads the file locally and computes its MD5 hash. Large files are read in chunks, so multi-gigabyte files work too.
  4. Only the first three characters of the hash are requested from our server; the full hash is matched in your browser. You see No Threat Detected or Malware Detected.

A hash check is fast and private, but it only recognises known malware files. A clean result means "not a known sample", not "guaranteed safe". For a second opinion, combine it with one of the methods below.

Method 2: Scan a single file with Microsoft Defender (Windows 10 and 11)

Every Windows 10 and 11 PC ships with Microsoft Defender Antivirus, which uses signatures, heuristics and cloud lookups.

  1. Right-click the file in File Explorer. On Windows 11, choose Show more options first.
  2. Click Scan with Microsoft Defender.
  3. The Windows Security window opens and shows the result for that file or folder.

From a command prompt you can scan a specific file with Defender's command-line tool:

"%ProgramFiles%\Windows Defender\MpCmdRun.exe" -Scan -ScanType 3 -File "C:\Users\you\Downloads\file.exe"

Method 3: Check a file on a Mac

macOS includes XProtect, which checks apps automatically when they are first opened, and Gatekeeper, which blocks unsigned or unnotarized apps by default. There is no "scan this file" button, so for a manual check:

  • Drag the file onto the iMalware scanner in Safari, Chrome or Firefox.
  • Check who signed an app with codesign -dv --verbose=4 /path/to/App.app and whether Gatekeeper accepts it with spctl -a -vv /path/to/App.app.
  • Compute a hash with md5 file.dmg or shasum -a 256 file.dmg and compare it with the checksum the developer publishes.

Method 4: Linux and the command line

The open-source ClamAV engine runs on Linux, macOS and Windows. After installing it and updating signatures with freshclam, scan a file or folder with clamscan -r /path/to/file. To get an MD5 to paste into our hash lookup, run md5sum file.

Method 5: Use a multi-engine online scanner

Services such as VirusTotal upload the whole file and run it through dozens of antivirus engines. That catches more than a single hash list, but your file leaves your device and, on some services, is shared with security researchers. Read our comparison of free online malware scanners before uploading anything private.

How to get a file's hash

SystemMD5SHA-256
Windows (Command Prompt)certutil -hashfile file.exe MD5certutil -hashfile file.exe SHA256
Windows (PowerShell)Get-FileHash file.exe -Algorithm MD5Get-FileHash file.exe
macOSmd5 fileshasum -a 256 file
Linuxmd5sum filesha256sum file

What to do if a file is flagged

  1. Don't open it. Downloading a file does not run it; double-clicking does.
  2. Delete it or let your antivirus quarantine it, and empty the Recycle Bin or Trash.
  3. If you already ran it, disconnect from the network, run a full scan with your antivirus (Defender's Microsoft Defender Offline scan is useful against stubborn threats), and change important passwords from a different, clean device.
  4. Think it's a false positive? Get the installer again from the developer's official site, compare the published checksum, and report it to us.

Frequently Asked Questions

Can I scan a file for malware without installing anything?

Yes. The iMalware scanner runs in your browser: drag a file onto it and it checks the file's MD5 hash against known malware. Windows users can also right-click a file and choose Scan with Microsoft Defender, which is built in.

Is downloading a file enough to infect my computer?

Usually not. Most malware needs to be opened or executed. That is why you should scan a downloaded file before you open it. Exceptions are rare browser or operating-system exploits, which is why keeping software updated matters.

Does a clean result mean the file is 100% safe?

No scanner can promise that. A hash check confirms the file is not a known malware sample. Brand-new or modified malware has a new hash. Use a full antivirus with behavioural detection as well, and only run software from sources you trust.

How do I scan a file for malware on my phone?

On Android, open imalware.com in Chrome and tap the drop zone to pick a file. On iPhone and iPad you can pick a file from the Files app the same way; iOS apps are sandboxed, so files you download cannot install themselves.