What Is a Computer Virus? Definition, 6 Types, Examples, and Removal Steps

What Is a Computer Virus? Definition, 6 Types, Examples, and Removal Steps

A computer virus is malicious code that attaches to a file or program and spreads to other files and devices when the host runs. This guide covers the definition, 3 working components, 6 types, famous examples, 6 warning signs, 7 removal steps, and 6 prevention methods.

  • A definition of a computer virus, with examples and the origin of the term
  • 3 working components of a virus, how a virus spreads, and what a virus does
  • 6 types of computer viruses, with the infection target of each
  • A comparison of viruses, worms, Trojans, and ransomware
  • 5 famous computer viruses, from Creeper (1971) to ILOVEYOU (2000)
  • Current malware volume and the motives behind virus creation
  • 6 warning signs of an infection
  • 7 steps that remove a computer virus
  • 6 prevention methods
  • Mac malware protection facts and 5 People Also Ask answers

What Is a Computer Virus?

A computer virus is malicious code that attaches to a program or file and replicates when the host runs. According to NIST, a virus is concealed software that spreads by copying itself into other programs. CISA describes a virus as malicious software that infects files or system areas on a drive, then duplicates itself. Examples of computer viruses include Elk Cloner, Brain, and Melissa.

How Was the Term Computer Virus Defined?

Fred Cohen formally defined the term in 1983 after laboratory experiments on a Digital Equipment Corporation VAX system. His definition described a program that modifies other programs to include a copy of itself.

How Does a Computer Virus Work?

A computer virus works through 3 components: an infection mechanism, a trigger, and a payload. These components perform 3 functions:

  • Infection mechanism: attaches the virus to a host file, document, macro, script, or boot area.
  • Trigger: activates the virus, such as when a user opens the infected file.
  • Payload: performs the harmful action after activation. The payload is separate from the replication function.

A virus requires a host file or program, and its code executes when the infected host runs.

How Does a Computer Virus Spread?

A computer virus spreads inside legitimate files through email, network shares, and removable media. Examples of removable media include USB drives and external hard drives. A virus requires user action to spread, such as running an infected file.

What Does a Computer Virus Do?

A computer virus corrupts or deletes data, spreads through email programs, and erases entire hard disks in severe cases. Some viruses only replicate, while others damage files or reduce system performance.

What Are the Types of Computer Viruses?

The 6 common types of computer viruses are file infector, boot sector, macro, resident, polymorphic, and overwrite viruses. Table 1 lists the infection target and behavior of each type.

Virus TypeInfection TargetBehavior
File infector virusExecutable filesRuns when the infected program executes
Boot sector virusBoot area of a disk or driveBrain infected the boot sector of floppy disks in 1986
Macro virusDocuments with macrosMelissa spread by mass mailing in 1999
Resident virusComputer memoryEmbeds in memory, which makes removal difficult
Polymorphic virusIts own codeCode changes help evade signature matching
Overwrite virusContent of host filesReplaces file content and destroys the original data

What Is the Difference Between a Virus, a Worm, and a Trojan?

A virus attaches to a host program, while a worm is self-contained and does not require a host. Malware is the broader category that includes viruses, worms, Trojans, and ransomware. Table 2 compares 4 malware types by host requirement, spread method, and example.

Malware TypeRequires Host FileSpread MethodExample
VirusYesRuns when the infected host runsBrain (1986)
WormNoSpreads independently across networksILOVEYOU (2000)
Trojan horseNoAppears as useful software and requires user actionEmotet
RansomwareNoEncrypts files and demands payment for a decryption keyCryptoLocker (2013)

Ransomware is malware, but it may lack the self-replication required to qualify as a true virus.

What Are Famous Examples of Computer Viruses?

Famous computer viruses include Creeper (1971), Elk Cloner (1982), Brain (1986), Melissa (1999), and ILOVEYOU (2000). Table 3 lists the year, target system, and significance of each.

YearNameTarget SystemSignificance
1971CreeperDEC PDP-10 computersExperimental self-replicating program written by Bob Thomas at BBN Technologies
1982Elk ClonerApple IICreated by 15-year-old Rich Skrenta, spread by floppy disk, and displayed a poem every 50th boot
1986BrainIBM PC (MS-DOS)Considered the first PC virus, created by two brothers in Pakistan
1999MelissaDocuments with macrosMass-mailing macro virus that showed the impact of email viruses
2000ILOVEYOUWindowsInfected millions of Windows machines within hours through an email with the subject line ILOVEYOU

How Many Computer Viruses Exist Today?

AV-TEST registers over 450,000 new malware programs and potentially unwanted applications every day. Malware instances grew from 1,300 in 1990 to 50,000 in 2000 and over 200 million in 2010. Many samples stay active for a short period, and only a few pose a permanent threat. Pure self-replicating viruses are less common today than blended threats.

Why Do People Create Computer Viruses?

People create computer viruses for experiments, pranks, software protection, and financial gain. Examples of early motives include 3 cases:

  • Creeper tested a theory of self-replicating programs.
  • Elk Cloner began as a prank by a high school student.
  • Brain was allegedly written to protect medical software from piracy.

Verizon data shows 95% of cyberattacks have financial motives.

What Are the Signs of a Computer Virus?

The 6 main signs of a computer virus are slow performance, frequent crashes, unexpected pop-ups, unfamiliar programs, missing files, and disabled security software. A drop in system performance is among the earliest and most consistent signs. Performance problems have many causes, and symptoms do not prove that a classic self-replicating virus is present. A malware scan confirms the diagnosis.

How Do You Remove a Computer Virus?

Remove a computer virus by running a full antivirus scan, then a Microsoft Defender Offline scan, if symptoms continue. Microsoft Defender Offline is the next step after a full scan finds nothing but suspicion remains. Follow these 7 steps on Windows:

  1. Disconnect the computer from the internet and local network.
  2. Restart the computer in Safe Mode.
  3. Run a full scan with Microsoft Defender or another antivirus program.
  4. Open Windows Security, click Virus & threat protection, select Scan options, choose Microsoft Defender Antivirus (offline scan), and click Scan now.
  5. Quarantine or delete each detected item following the on-screen instructions.
  6. Restart the computer and check for remaining symptoms.
  7. Contact a trusted technician or the device manufacturer, if the infection remains.

The offline scan restarts the computer and scans before Windows loads. The scan takes around 10 minutes.

How Do You Prevent a Computer Virus?

Prevent a computer virus by keeping antivirus software and the operating system updated and avoiding unknown attachments and downloads. Follow these 6 methods:

  1. Install antivirus software and update its definitions. Antivirus products depend on frequent definition updates because virus authors modify code to evade detection.
  2. Update the operating system and applications.
  3. Avoid opening unknown email attachments.
  4. Download software only from official stores and publisher websites.
  5. Scan removable drives before opening files.
  6. Back up files to a cloud service or external drive.

What Else Do People Ask About Computer Viruses?

Is a Computer Virus the Same as Malware?

A computer virus is 1 type of malware that attaches to host files and replicates.

Can a Computer Virus Spread Without the Internet?

Yes, viruses spread through removable media such as USB drives.

Can You Get a Virus From Email?

A virus spreads through email when the recipient opens an infected attachment.

Are Computer Viruses Still Common?

Pure self-replicating viruses are less common than blended threats, but AV-TEST registers over 450,000 new malicious programs daily.

Can Antivirus Software Detect Every Virus?

Antivirus software detects known viruses through signature updates, so new variants remain undetected until definitions update.

What Is a Computer Virus in Short?

A computer virus is malicious code that attaches to a file or program, replicates when the host runs, and spreads through email, shared files, and removable media. Antivirus software, system updates, and cautious downloads reduce infection risk.

How was this computer guide checked?

The editorial check compares each Windows path, command and warning with official Microsoft documentation and the relevant computer maker’s support material. Model-specific steps point readers to the applicable manual. We do not claim a physical lab test unless the page names the hardware and result.

Documentation review date: 9 November 2026. Report a correction through the site’s editorial process.

About this computer troubleshooting guide

Published by the PC Help Pro Editorial Team. Last reviewed 9 November 2026. We check procedures against current Microsoft and computer-manufacturer documentation, label model-specific steps, and do not sell repair software, parts or computers.

Read about PC Help Pro, how the fixes are checked, and the editorial policy.