Malware & ransomware

How to Not Get a Computer Virus: 10 Habits That Actually Stop Malware

Most computer viruses need your help to get in — a click, a download, or a missed update. Here are the 10 habits that close those doors, and what to do if one slips through.

Cysoro Security TeamPublished · 9 min read
BLOCKED ✕ ✓ MALWARE & RANSOMWARE How to not get a computer virus 10 habits that actually stop malware.
Quick answer

To avoid a computer virus, keep your operating system and apps updated automatically, run reputable antivirus protection, download software only from official sources, scan files and USB drives before opening them, and think before clicking links or attachments. Add unique passwords with multi-factor authentication, use a standard account for daily work, and keep tested backups.

Key takeaways

  • Most viruses arrive through phishing, unpatched software, fake downloads and USB drives — not through clever hacking.
  • Automatic updates, reputable antivirus and official download sources block the routes most malware uses.
  • If a virus gets in, disconnect the device, run a full scan, change passwords from a clean device, and restore from backup.

A computer virus is not bad luck. It is software that got onto your machine through a door you left open: an update you skipped, a link you clicked, a download from the wrong site, or a USB drive you trusted. Close those doors and most viruses never arrive.

What is a computer virus, and how does it spread?

A computer virus is malicious code written to damage a device, steal data, or take control of a system without permission. The term covers viruses, trojans, ransomware, spyware, and other malware, and the prevention habits are largely the same for all of them.

Malware reaches devices through a short list of routes: phishing emails with malicious links or attachments, downloads from unofficial or pirated sources, software flaws that were patched months ago but never installed, infected USB drives, and malicious ads on compromised websites. Prevention is about closing those doors, one habit at a time.

One useful frame from CISA's guidance on malicious code: install and maintain anti-malware software, be cautious with links and attachments, block pop-up ads, use accounts with limited permissions, keep software updated, back up data, and use a firewall. Every step below maps to one of those recommendations.

How do viruses actually get in?

Knowing the route helps you block it. These are the main infection vectors, in rough order of how often they succeed against home users and small businesses.

RouteHow it worksWhat stops it
Phishing emailFake message tricks you into clicking a link or opening an attachmentThink before you click; verify the sender; scan attachments
Unpatched softwareMalware exploits a security hole already fixed by an updateAutomatic updates everywhere
Fake downloadsFree software, cracks, or look-alike apps bundle malwareOfficial sources only; check the developer
USB drivesInfected drive runs code when plugged inScan before opening; disable AutoRun
Drive-by downloadsCompromised site or ad silently downloads malwareUpdated browser; ad blocker; antivirus
Weak passwordsStolen credentials let attackers install malware remotelyUnique passwords; MFA on every account

Phishing is still the most common gateway. Human action, such as clicking a link or opening an attachment, played a part in a large share of breaches in Verizon's analysis as summarized in malware guides, and CISA publishes practical advice on recognizing and reporting phishing. The WannaCry ransomware spread through a Windows flaw Microsoft had already patched in March 2017 — it only worked on machines that never installed the fix.

The four doors malware uses — and what closes themPhishing emailFake link or attachment in a messageClose it: verify before you clickUnpatched softwareKnown hole, fix already releasedClose it: automatic updatesFake downloadsPirated apps, cracks, look-alike installersClose it: official sources onlyUSB drivesFound or borrowed drive runs codeClose it: scan first, disable AutoRun
Most infections use one of four routes. Close them and most malware never arrives. Illustration by Cysoro.

1. Keep everything updated — automatically

Updates are the single most effective defense, and CISA lists them among its basic steps for everyone. Many infections use security holes that were fixed months earlier; they only work on devices that never installed the fix.

  • Turn on automatic updates for Windows, macOS, iOS, and Android.
  • Update browsers, browser extensions, Office, PDF readers, and your router's firmware too.
  • Replace devices and software that no longer receive security updates — an unsupported device cannot be patched, however careful you are.
  • Avoid installing updates while on untrusted networks, and always get them from the vendor directly, not from a link in an email.

If you run a small business, keep an inventory of devices and software so nothing is forgotten. One unpatched laptop can infect a whole office.

2. Use reputable antivirus protection

Modern antivirus does more than match known virus signatures. It watches how programs behave and can stop ransomware that starts encrypting files. Windows includes Microsoft Defender Antivirus, which is enough for most home users when it is switched on and updated.

Run only one real-time antivirus at a time — two can conflict and slow the computer down. Keep it updated, run a full scan monthly, and do not ignore its warnings. If it blocks a download, believe it: the file is not worth the risk.

Businesses should use a managed endpoint product with central monitoring, so an alert on one laptop reaches IT instead of sitting unread. See our guide to the best cybersecurity for remote workers for endpoint options that fit small teams.

3. Think before you click links and attachments

Phishing is still one of the main delivery methods for malware. A fake email from a bank, a coworker, or a service like Netflix tricks you into clicking a malicious link or downloading an infected attachment.

  • Check the sender address, not just the display name. Look for odd spellings or a wrong domain.
  • Hover over links to see the real URL before clicking — on a phone, long-press instead.
  • Do not open unexpected attachments, even from people you know. If a colleague sends a file you did not ask for, ask them about it on another channel first.
  • Watch for urgency. Messages that demand immediate action — "your account is suspended" or "pay within the hour" — are designed to stop you thinking.
  • Use email filters to catch suspicious messages, and report phishing with the button in your email app.

Our guide to spear phishing shows how targeted versions of these attacks work, and why a familiar name in the From line is not proof of anything.

4. Download only from official sources

Fake apps and bundled adware are a major infection route. Free software from a random site, a pirated app, or a "cracked" version of a paid program often carries malware as the real price.

  • Download apps from the official site, the Microsoft Store, Google Play, or Apple's App Store.
  • Check the developer name and read recent reviews before installing.
  • Avoid "too good to be true" free software, especially free versions of expensive tools.
  • During installation, read each screen and decline bundled toolbars and extra programs.
  • Scan every downloaded file with your antivirus before opening it.

5. Scan USB drives and external files before you open them

USB sticks are a common way for malicious code to arrive. Never plug in a USB drive you found or were given by a stranger, and scan every external drive before opening its files.

Right-click a downloaded file or a USB drive and scan it with your antivirus before opening anything on it. Disable AutoRun and AutoPlay for external media, so an infected drive cannot execute code the moment it is plugged in. The same rule applies to files from clients, suppliers, and colleagues: scan first, open second.

6. Use unique passwords and multi-factor authentication

Weak or reused passwords let attackers log in and install malware remotely, and a single stolen password can spread an infection across every account that shares it. CISA flags weak, compromised, and default passwords as a main entry route for ransomware.

Use a password manager to create a long, random, unique password for every account, and turn on multi-factor authentication wherever it is offered — preferably phishing-resistant MFA such as passkeys or a security key. A password manager will not autofill on a fake site, which is an extra warning.

You can check whether a password you use has already appeared in a breach with our free pwned password checker.

7. Use a standard account for daily work

Malware that runs as an administrator can install itself deep in the system. Malware that runs as a standard user is far more limited, which is why CISA recommends using accounts with limited permissions.

Create a separate administrator account and use a standard (non-admin) account for daily work. When software needs to install, you will be asked for the admin password — a natural pause that stops many infections. The same logic applies at work: staff should not have admin rights on their own laptops unless their job requires it.

8. Browse safely, especially on public Wi-Fi

Drive-by downloads and malicious ads can infect a device without any click on a download button. Safe browsing habits are your first line of defense against that route.

  • Keep your browser updated and use an ad blocker to avoid malicious pop-ups.
  • Avoid websites with suspicious URLs or poor security, and do not ignore certificate warnings.
  • Use sites that use HTTPS when you access or provide personal information.
  • On public Wi-Fi, use a VPN and keep your firewall on. Our guide to how to secure your Wi-Fi covers home networks in detail.
  • Remove browser extensions you do not recognize or no longer use — extensions are a common malware route.

9. Back up your files — and test the restore

Backups do not prevent a virus, but they decide whether an infection is an inconvenience or a disaster. CISA lists regular patching and tested offline backups as the two fundamental defenses against ransomware.

Keep at least one encrypted backup offline — a drive you disconnect, or a cloud backup with versioning — and restore a test file regularly to prove it works. A backup the attacker can reach and encrypt is not a backup. If ransomware locks your files, restore from the clean backup instead of paying: law enforcement advises against paying, because payment does not guarantee your files back.

Your daily virus-prevention checklist✓ Automatic updates turned on✓ Antivirus on and updated✓ Think before you click✓ Official downloads only✓ Scan USB drives first✓ Unique passwords + MFA✓ Standard account for daily work✓ Backups tested, one offline
Eight habits that block most malware. Print it, pin it, follow it. Illustration by Cysoro.

How do you know if your computer already has a virus?

Some infections are silent, but most leave signs. Watch for sudden slowness, frequent crashes or pop-ups, programs you did not install, browser settings that changed on their own, or friends receiving strange messages from your accounts.

If you see those signs, run a full antivirus scan, check installed programs and browser extensions for anything unfamiliar, and change your important passwords from a clean device. Do not ignore the signs — malware that sits unnoticed can steal data for weeks before ransomware is deployed.

What should you do if you get a computer virus?

Act quickly and in the right order. Speed limits the damage, and a calm sequence beats panic-clicking.

  1. Disconnect from the network. Unplug ethernet or turn off Wi-Fi so the malware cannot spread or phone home.
  2. Run a full antivirus scan and follow its instructions to quarantine or remove what it finds. If the antivirus is disabled, use a second-opinion scanner from a clean device.
  3. Change your passwords from a clean device, starting with email, banking, and cloud accounts. Turn on MFA as you go.
  4. Restore from backup if files are encrypted or the system cannot be trusted. Wipe and reinstall the operating system if the infection is deep.
  5. Tell your IT team or, at home, warn anyone who shares the network. Scan other devices before reconnecting the infected one.
  6. Report ransomware to the FBI's Internet Crime Complaint Center at ic3.gov if files were encrypted or money was demanded.
Do not pay a ransomPaying does not guarantee your files back, and it funds further attacks. Restore from a clean backup instead, and report the incident.

The bottom line

Avoiding a computer virus is mostly habit, not technology: automatic updates, reputable antivirus, official downloads, scanned USB drives, careful clicking, unique passwords with MFA, a standard account, and tested backups. No single step is enough on its own, but together they close the doors most malware uses.

Start with the two that matter most today — turn on automatic updates and check that your antivirus is running — then work through the checklist. You can check the strength of the passwords protecting your accounts with our free password strength checker.

Frequently asked questions

How do computer viruses get on your computer?

Most arrive through phishing emails with malicious links or attachments, downloads from unofficial sites, unpatched software with known security holes, infected USB drives, and malicious ads on compromised websites. A virus rarely breaks in on its own — it usually needs a click, a download or a missed update.

Does antivirus stop all viruses?

No. Antivirus catches known malware and much suspicious behavior, but new malware and well-crafted phishing can slip past it. That is why updates, safe downloads, backups and careful clicking matter as much as the antivirus itself.

Can you get a virus just by visiting a website?

Yes, through drive-by downloads and malicious ads, especially on unpatched browsers or compromised sites. Keeping your browser updated, using an ad blocker and avoiding suspicious sites greatly reduces the risk.

Can a Mac or Chromebook get a virus?

Yes, though less often than Windows. Macs and Chromebooks can run malicious browser extensions, fake apps and phishing pages, and Mac malware exists. The same habits — updates, official app stores, antivirus where available and careful clicking — apply.

Is free antivirus good enough?

For most home users, yes, if it is reputable and kept updated — Microsoft Defender Antivirus, built into Windows, is enough for most home users when switched on and updated. Businesses and high-risk users should consider a managed endpoint product with central monitoring.

How do I know if my computer has a virus?

Warning signs include sudden slowness, frequent crashes or pop-ups, programs you did not install, browser settings that changed on their own, and friends receiving strange messages from your accounts. Run a full antivirus scan and check for unfamiliar programs and browser extensions.

Should I pay a ransom if ransomware locks my files?

Law enforcement and CISA advise against paying: payment does not guarantee your files back, and it funds further attacks. Restore from a clean backup instead, and report the incident to the FBI's Internet Crime Complaint Center.

Can a virus spread from my computer to other devices?

Yes. Malware can spread over a home or office network, through shared drives, and through infected USB drives. If one device is infected, disconnect it from the network and scan other devices before reconnecting it.

Sources

  1. CISA — Protecting Against Malicious Code (via BleepingComputer)
  2. BlogyWire — How Can You Prevent Viruses and Malicious Code?
  3. Washington State DFI — Protecting Yourself From Cyber Attacks
  4. VPN.com — Malware Guide: Types, Risks and Protection Tips
  5. LogMeOnce — Ransomware Prevention Tips: 10 Steps That Work
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 guidance on protecting against malicious code and ransomware, and the Washington State Department of Financial Institutions consumer guidance.

How we write and fact-check →

See where your domain stands

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

Start free