Malware & ransomware

What Is a Computer Virus? Types, Spread and Removal

A computer virus needs a host program and a human action to spread. Here is how viruses work, how they differ from worms and trojans, and what to do if you are infected.

Cysoro Security TeamPublished · 9 min read
MALWARE & RANSOMWARE Computer Virus What it is, how it spreads, how to stop it > virus.exe detected infected: invoice.doc infected: photos.zip copying to host files... quarantine recommended cysoro.com
Quick answer

A computer virus is a type of malicious software that spreads by inserting copies of itself into other programs or system areas, and runs when the infected program runs. Unlike a worm, a virus cannot spread on its own: it needs someone to open an infected file, run an infected program or boot from infected media. Most viruses today arrive through email attachments, malicious downloads and infected documents.

Key takeaways

  • A computer virus copies itself into host programs and runs when the host runs; it needs a human action to spread.
  • Worms spread without help, trojans hide inside legitimate-looking software, and ransomware encrypts your files for payment.
  • Remove a virus by disconnecting the device, running a full security scan, and changing passwords from a clean device.

The word "virus" gets used for almost every computer problem, from a slow laptop to a ransomware attack. In security terms it means something specific: a program that copies itself into other programs and runs when its host runs. Knowing the exact definition helps you spot infections faster and avoid the wrong fixes.

What is a computer virus?

A computer virus is a type of malicious software that spreads by modifying other programs to include a copy of itself, and is executed when the infected program is invoked. That is the definition used by NIST, the US standards body, in its cybersecurity glossary.

CISA puts it more plainly: a virus is a program that spreads by first infecting files or the system areas of a computer's hard drive and then making copies of itself. Some viruses are harmless, others may damage data files, and some may destroy files entirely.

Three traits define a virus. First, it needs a host: unlike a worm, a virus attaches itself to an existing file, script, document or boot record, and it cannot run by itself. Second, it needs a human action to run: someone must open the document, launch the application or boot from the infected media. Third, it replicates: producing more copies is its core purpose, while destructive payloads are optional extras.

How does a computer virus work?

A virus follows the same life cycle whether it was written in 1986 or last week: delivery, execution, replication, and then its payload, if it has one.

The life cycle of a computer virus 1 Delivery email attachment, download, USB stick 2 Execution you open the host file or program 3 Replication virus copies itself into new hosts 4 Payload delete files, steal data or stay quiet Break the chain at step 2: do not open files you were not expecting.
The four stages of a virus infection. Illustration by Cysoro.

Delivery is usually an email attachment, a download from a compromised site, a shared drive file or a USB stick. Viruses used to spread mainly through shared floppy disks; today they are primarily spread through email messages, according to CISA.

Execution is the moment you open the host. The viral code gains control before or alongside the legitimate program, then searches for new hosts on your system and copies itself into them. Some viruses trigger immediately; others wait for a date or an event before acting.

The payload is whatever the virus was written to do: delete or corrupt files, steal passwords, open a back door for attackers, or simply spread as far as possible. Many modern viruses do no obvious damage at all — they quietly steal data or turn the machine into part of a botnet.

What is the difference between a virus, a worm and a trojan?

These three terms are often used interchangeably, but they describe different behavior. The distinction matters because each one needs a different defense.

VirusWormTrojanRansomware
Needs a host fileYesNoNo, it is the program itselfOften delivered by a trojan
Spreads aloneNo, needs a human actionYes, across networksNo, needs the victim to install itNo, needs an entry point
Main harmDamages or infects filesConsumes memory and bandwidthOpens a back doorEncrypts files for payment
Classic exampleBrain (1986)Self-propagating network wormsFake software installersModern extortion malware

A worm is a type of virus that can spread without human interaction, CISA explains, and worms often spread from computer to computer and take up valuable memory and network bandwidth, which can cause a computer to stop responding.

A trojan horse is a program hiding a virus or other damaging program inside something that looks legitimate. Ransomware is usually delivered by a trojan or a phishing email, and its payload is encryption plus extortion.

Modern malware often mixes all three: a trojan delivers the infection, virus-style code spreads it to local files, and a worm component moves it across the network. That is why security teams now talk about malware families rather than single neat categories.

What are the main types of computer virus?

Viruses are grouped by where they hide and how they behave. These are the types you are most likely to meet.

File infector viruses

The classic type. A file infector attaches itself to executable programs and runs whenever the program runs, then infects other programs on the same machine. These were dominant in the 1990s and still appear in pirated software.

Boot-sector viruses

These infect the boot sector of a disk, so they run before the operating system even loads. Brain, the 1986 virus widely regarded as the first to spread on personal computers, was a boot-sector virus that travelled on shared floppy disks.

Macro viruses

Macro viruses hide in documents, spreadsheets and presentations, using the application's own macro language to run when the document opens. They are one reason modern office software disables macros from untrusted files by default.

Polymorphic and stealth viruses

Polymorphic viruses change their own code each time they copy themselves, so signature-based scanners struggle to recognize them. Stealth viruses hide their presence by intercepting the system's attempts to look at infected files.

Resident and multipartite viruses

Resident viruses load into memory and stay there, infecting every program you open afterwards. Multipartite viruses infect both files and boot sectors, so removing one half leaves the other to reinfect the machine.

How does a computer virus spread?

Almost every infection starts with a human decision: opening an attachment, running a download, or visiting a malicious page. CISA states that most users get viruses from opening and running unknown email attachments.

  • Email attachments: the most common route. The attachment pretends to be an invoice, a delivery notice, a CV or a document from a colleague. Modern phishing kits make these messages look convincing, which is why our guide to spear phishing is worth reading alongside this one.
  • Malicious downloads: fake software installers, cracked programs and "free" versions of paid apps are classic carriers.
  • Malicious web pages: a drive-by download tries to exploit a browser or plugin flaw when you simply visit the page.
  • Removable media: USB sticks and shared drives still carry infections between machines, especially in offices and schools.
  • Malicious documents: Word documents and PDFs that exploit weaknesses in the program used to open them, often by asking you to enable macros or content.

Social engineering is the thread through all of these. NIST notes that current malware relies heavily on tricking people into running files that look harmless. That is also why the human element appears in about 60% of breaches in Verizon's Data Breach Investigations Report: the technology is often fine, and the person is the way in.

What are the signs of a computer virus?

Viruses try to stay quiet, but they usually leave clues. Watch for these symptoms, especially if several appear at once.

  1. Sudden slowness: programs take far longer to open, or the fan runs constantly with nothing open.
  2. Frequent crashes or freezes: the system restarts or locks up without explanation.
  3. Pop-ups you did not ask for: ads or warnings appearing outside the browser, or fake security alerts urging you to call a number.
  4. Programs starting on their own: applications launching, or browser tabs opening, without your input.
  5. Files changing or disappearing: documents renamed, encrypted or missing, or new files you do not recognize.
  6. Security software disabled: your antivirus will not open, updates fail, or its warnings vanish.
  7. Strange network activity: the device sends mail you did not write, or contacts report receiving odd messages from you.
  8. New toolbars or home pages: your browser's settings changed without your permission.

One symptom alone may have an innocent cause — a failing hard drive also slows a computer down. Several together, especially after opening an unexpected attachment, should be treated as an infection until a full scan proves otherwise. If your phone shows similar signs, see our guide on how to know if your phone is hacked.

What are some famous computer viruses?

Real cases show how the same mechanics repeat at larger scale. The Brain virus of 1986 spread on floppy disks and is widely regarded as the first personal-computer virus. It was relatively harmless — it displayed a message and slowed disks — but it proved the concept.

Later viruses added theft and destruction. Macro viruses in the late 1990s spread through shared office documents, and network worms in the 2000s showed how fast self-propagating code could move.

The pattern continues today. Microsoft reported that between March and May 2025, more than 394,000 Windows computers were infected with Lumma Stealer, a password-stealing malware sold as a service. In May 2025 its operators' infrastructure of about 2,300 domains was seized under a US court order.

The scale of the problem is visible in the FBI's figures. Phishing and spoofing were the most-reported internet crime in the US in 2025, with 191,561 complaints, and total reported cybercrime losses reached about $20.9 billion. Most of those attacks start the same way a virus does: with someone opening something they should not have.

How do you prevent a computer virus?

Prevention is mostly habit, not software. Antivirus helps, but the decisions you make before you click matter more.

Five layers that keep viruses out 1 Keep software updatedpatch the operating system, browser and office apps promptly 2 Run security softwarereal-time antivirus with automatic updates, on every device 3 Pause before you openunexpected attachment? verify with the sender first 4 Back up offlineregular backups you can restore from if files are damaged 5 Use a standard accountdaily work without admin rights limits what malware can do
Defense in depth against computer viruses. Illustration by Cysoro.
  • Update everything. Most drive-by infections exploit flaws that already have patches. Turn on automatic updates for your operating system, browser and office software.
  • Use reputable security software and keep it updated. Windows includes Microsoft Defender; macOS includes XProtect. Either is far better than nothing.
  • Do not open unexpected attachments, even from people you know — their account may be compromised. Verify first through another channel.
  • Download software only from official sources. Avoid cracked software and third-party download sites entirely.
  • Back up regularly to a drive you disconnect afterwards, so an infection cannot reach the backup too.
  • Use a standard user account for daily work instead of an administrator account, which limits what malware can install.

For a wider routine that covers updates, backups and device security together, see our small business cybersecurity checklist.

How do you remove a computer virus?

Act quickly, and in the right order. Speed matters because a virus may be stealing data or spreading while you decide what to do.

  1. Disconnect from the internet. Unplug the network cable or turn off Wi-Fi so the virus cannot send data out or download more malware.
  2. Run a full scan with your security software, updated first if possible. Let it quarantine or delete what it finds, then run a second scan.
  3. Use a second opinion scanner if the first finds nothing but symptoms persist. A rescue disk or a second vendor's on-demand scanner can catch what the first missed.
  4. Change your passwords from a clean device, starting with email and banking. Check whether any password appears in known breaches with our free pwned password checker.
  5. Check for persistence: look for unfamiliar startup programs, new mail-forwarding rules, and unknown devices signed in to your accounts.
  6. Restore from backup if needed. If files are damaged or encrypted, restore from a clean backup rather than paying anyone.
  7. Reinstall as a last resort. If the infection resists removal, back up your documents, wipe the drive and reinstall the operating system. It is drastic, but it is the only certain cure for a deeply embedded infection.
Do not pay a ransomIf files were encrypted, do not pay. Payment does not guarantee decryption, it funds the next attack, and it may be illegal if the recipients are sanctioned. Restore from backup and report the incident to the FBI's Internet Crime Complaint Center.

The bottom line

A computer virus is malicious code that copies itself into other programs and runs when the host runs. It needs you to open something to spread, which means the best defense is a pause before you click, plus updated software, security tools and offline backups.

If you suspect an infection, disconnect, scan, and change your passwords from a clean device. And remember that the fake funeral notification emails described in our funeral email scam guide are one of the ways viruses still reach ordinary people — a moment of grief, one click, and the infection is in.

Frequently asked questions

What is a computer virus in simple terms?

A computer virus is a harmful program that hides inside another program or file and makes copies of itself. When you run the infected program, the virus runs too, and it can damage files, steal information or infect other programs on your computer.

What is the difference between a computer virus and malware?

Malware is the general term for all malicious software, including viruses, worms, trojans, spyware and ransomware. A virus is one specific type of malware: the one that spreads by copying itself into host programs.

Can a computer virus spread without me doing anything?

A classic virus cannot: it needs you to open an infected file or run an infected program. A worm is different and can spread across a network without any human action, which is why worms can infect thousands of machines in hours.

How do I know if my computer has a virus?

Common signs are sudden slowness, frequent crashes, pop-ups you did not ask for, programs starting on their own, files disappearing or changing, and your security software being disabled. Any one of these deserves a full security scan.

Can a virus infect a Mac or a phone?

Yes, although Windows is targeted most often because it has the most users. Macs and Android phones can be infected by malicious apps and downloads, and iPhones are most at risk when jailbroken or tricked into installing profiles from untrusted sources.

How do I remove a computer virus?

Disconnect the device from the internet, run a full scan with up-to-date security software, and follow its instructions to quarantine or delete the infection. Then change your passwords from a clean device and check for unfamiliar forwarding rules or devices on your accounts.

Can opening an email give me a virus?

Opening a plain-text email is usually safe, but opening an attachment or clicking a link in a phishing email is the most common way infections start. If your email client allows scripting, even opening a message can be risky, which is why CISA advises against opening attachments from unknown senders.

What was the first computer virus?

The Brain boot-sector virus, which appeared in 1986, is widely regarded as the first virus to spread on personal computers. It infected the boot sectors of floppy disks, so it spread whenever people shared disks — the 1980s version of sharing infected files.

Sources

  1. CISA — Virus Basics
  2. NIST CSRC Glossary — virus
  3. FBI Internet Crime Complaint Center — 2025 IC3 Annual Report
  4. Verizon — Data Breach Investigations Report
  5. The Open University — Introduction to cyber security: stay safe online
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against CISA's Virus Basics, the NIST CSRC glossary definition of a virus, and the FBI IC3 2025 annual report.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free