What Is a Computer Virus?

Follow best practices to reduce your risk of infection

Cyber Attacks

Petri Oeschger/Getty Images

Viruses are software programs that install on a computer without the user's consent or knowledge, for the purpose of making harmful changes that the user likely wouldn't authorize.

Types of Computer Viruses

Viruses as a class of malware don't do anything beyond modify existing data or program files. The purpose of these modifications, however, divides the world of viruses into three categories.


A trojan horse is a type of virus that pretends to be something other than what it is. For example, a file that appears to be a legitimate freeware application might include a malware installer. Because you're tricked into downloading what appears to be a legitimate file, the malware gains control over important parts of your computer's operating system.


Worms don't need to trick you into installing them; they often come through email or other ways that escape your notice. Older email programs that automatically displayed HTML messages were especially vulnerable because the email program itself perpetuated the worm.


A program that records information about you, or sends your data to a remote server, is called spyware. These programs compromise your privacy and potentially expose your personal information to a vast dark web network.

Mode of Transmission

Viruses spread from one computer to another through the sharing of "infected" files. Common methods for spreading viruses include floppy disks, FTP file transfers, email messages, and copying files between shared network drives.

Once installed on a computer, a virus modifies or removes application and system files. Some viruses render a computer inoperable; others display startling screen messages to unsuspecting users.

Anti-Virus Protection

Advanced antivirus software programs combat viruses. Antivirus software examines the contents of local hard drives to identify patterns of data called "signatures" that match known viruses.

As new viruses infect computers, antivirus software manufacturers update their signature definitions to match, then deliver these definitions to users via network downloads.

Protection Against Viruses

Follow these best-practice procedures to avoid viruses:

  • Use an anti-virus scanner. The Windows Defender built into Windows 10 is a great default option.
  • Never click unfamiliar links, especially in email messages.
  • Download software from legitimate sources.
  • Avoid pirated software.
  • Stay away from problematic websites.