Computer virus: meaning and how it spreads
Learn how a computer virus infects a host file, how it differs from worms and Trojans, and what a virus alert can tell you about the next step.
A computer virus is malicious code that replicates by infecting a host, such as a program or document, and runs when that host is executed or activated.
Also called: virus, computer viruses, file infector, macro virusWhat makes malicious code a virus
A computer virus uses another file or object as its host. When the infected host runs, the virus can execute and infect additional hosts. Replication is the defining feature: a harmful program that steals information but does not infect other hosts is not automatically a virus.
Imagine an infected utility that still opens its normal window. Running it could also activate code that modifies other programs. Sending one of those infected programs to another person could carry the infection onward. This is an illustrative example of the mechanism, not a description of every virus or a way to test a suspicious file.
NIST’s malware guide distinguishes viruses that depend on a host from self-contained threats. That distinction remains useful even though the guide’s product references date from 2013. For the broader category of harmful software, read malware.
Virus, worm, and Trojan compared
People often use “virus” to mean any infection. A security report may use the word more narrowly. Understanding the category helps you ask what happened without assuming that the category is a complete incident report.
| Term | Defining feature | What to investigate |
|---|---|---|
| Virus | Replicates by infecting a host | Which hosts were detected and whether they ran or were shared |
| Worm | Replicates as a self-contained program | The route between devices and whether other devices are affected |
| Trojan | Conceals a malicious purpose behind an apparently legitimate program | What ran and which actions it performed |
| Malware | The broader category of malicious software or code | The specific behavior, affected items, and recovery needs |
A worm may carry a harmful payload, and a Trojan may install additional malware. These terms can describe different components of the same attack. Microsoft’s threat overview provides vendor explanations of the categories; a name alone does not establish the extent of an infection.
Different hosts create different risks
File-infecting viruses insert malicious code into program files. The application may keep some of its normal behavior, which can make a problem less obvious than a broken file. Finding one infected executable raises the question of whether other executables were affected; it does not answer that question.
Macro viruses use a document application’s macro language and replicate through documents or templates. Macros also serve legitimate automation purposes. A macro-containing document is therefore not necessarily malicious, and macro malware is not necessarily a virus: malicious macros can instead download or launch another threat. Microsoft’s macro malware guidance describes deceptive documents and these additional payloads.
Boot-sector viruses target disk areas involved in starting a system. This is a distinct historical virus category, not a diagnosis to infer whenever a computer fails to start. Startup failures have many causes. Avoid improvising disk repairs on the strength of the word “virus”; the wrong repair can create a separate recovery problem.
The useful detail is the affected object and the product’s findings. A label such as “file infector” may guide further investigation, while a generic threat name leaves more uncertainty.
Symptoms cannot identify a virus by themselves
Crashes, altered files, and unusual resource use can justify checking a device. None is a reliable test for viral replication. An application can crash because of an update, damaged storage, or an ordinary bug; malicious code can also run without a visible symptom.
Record the sequence instead: the application or document involved, where it came from, when it was opened, and what changed afterward. If you only have a browser warning claiming an infection, check your installed security application’s history before treating the claim as real. The infection diagnostic helps organize those observations.
Do not reopen a suspected infected file to reproduce the behavior. That would add exposure without establishing which code caused the problem.
Reading a virus detection
A detected item might be an unopened download, an infected file already on the device, or an entry inside an archive. Those situations require different follow-up. Read the file location, detection time, and completed action alongside the threat name.
On Windows, Protection History explains security events and actions. A quarantined file has been isolated; that does not automatically establish that every related file was checked. An unresolved alert still needs attention. If you suspect a mistake, follow the false positive evidence process before restoring the item.
Removal, affected files, and recovery
Use an updated security product and review its results rather than deleting files solely because their names look unfamiliar. The Windows scanning guide provides a route into the site’s scan guidance. A work or school device should go through its IT team, particularly if shared files or several devices may be involved.
Cleaning a host and recovering usable data are separate questions. Some affected files may need replacement from a trusted original or a verified backup. Retaining a backup is valuable, but restoring the same infected program could reintroduce the problem. Document what was detected and where before deciding what to restore.
Finally, ask whether anything was shared while it was potentially infected. A report about one computer does not settle the status of a copied program on another device. Follow-up should address the actual hosts and transfers involved, with qualified help when the scope is unclear.
Sources & documentation
Sources checked on 6 Oct 2026. Documentation research does not establish independent testing.