A trojan is malware that disguises itself as legitimate software so you install and run it yourself, and it does not copy itself. A virus attaches itself to a host file and copies itself into other files when that file runs. Both are malware, but they spread differently, so they need different cleanup steps.
Key takeaways
- A trojan spreads by deception and needs you to run it; a virus spreads by infecting host files and copying itself.
- A trojan does not self-replicate, while a virus and a worm do, which changes how you contain each infection.
- Both can steal data, install more malware or open a backdoor, so removal means isolating the device, scanning it and changing passwords.
People use the words trojan and virus as if they mean the same thing. They do not. Both are malware, but they get into your device in different ways, spread in different ways, and need different cleanup steps.
What is the difference between a trojan and a virus?
A trojan disguises itself as legitimate software so you install it yourself, and it does not copy itself. A virus attaches itself to a host file and copies itself into other files when that file runs.
The difference is about propagation, not damage. A trojan is defined by deception: it looks like a useful app, a document, an update or a game. A virus is defined by infection: it needs a host file to live in, and it spreads when that host file is opened or shared.
That distinction matters when you respond. With a virus, you must find and clean every infected file. With a trojan, you must find what the user ran, what it dropped, and where it reached, because the trojan itself is usually only the first stage.
What is a trojan?
A trojan, short for Trojan horse, is malware packaged to look like legitimate, desirable or harmless software so you install and run it yourself. The name comes from the Greek story of the wooden horse wheeled into Troy: the danger is invited in because it looks like a gift.
Two properties define a trojan. First, the disguise is the whole technique: a fake invoice, a free app, a software update, a game crack or a PDF that is not what it claims to be. Second, it needs you to run it. A trojan does not self-replicate and does not self-execute. It sits there until a person launches it.
Once it runs, a trojan can do almost anything: steal passwords, log keystrokes, open a backdoor for remote access, spy through a webcam, download more malware, or encrypt files as ransomware. The payload varies, but the entry method does not.
What is a virus?
A virus is malware that attaches itself to a file or program and copies itself when that file is opened and run. It cannot do anything on its own: it needs a host file, and it needs a person to open, share or move that file.
Think of it like a parasite. The virus inserts its code into a legitimate document, application or executable. When you run the infected file, the virus runs with it, and it can then attach itself to other files on the same device. When you share an infected file with someone else, the virus travels with it.
Viruses are often disguised as something you would want — a game, a free tool or a download — with an appealing name designed to get you to click, open or run it. Once active, a virus can corrupt or delete data, slow the system, or deliver a further payload.
Trojan vs virus: side-by-side comparison
The table below sums up the core difference: a trojan spreads by tricking you, a virus spreads by infecting files, and a worm spreads on its own.
| Trojan | Virus | Worm | |
|---|---|---|---|
| Needs a host file? | No, it is the file | Yes, by definition | No |
| Self-replicates? | No | Yes, into other files | Yes, host to host |
| Spreads on its own? | No | No | Yes |
| Needs you to act? | Yes, you must run it | Yes, you must run the host file | Usually not |
| Defining trait | Disguise and user execution | Host-file infection | Autonomous network spread |
| How you usually meet it | Fake app, update or attachment | Infected file or download | Network, email or infected site |
| Typical goal | Steal data, open a backdoor, drop more malware | Corrupt files, spread, deliver a payload | Spread fast, overload systems, deliver a payload |
Malware categories overlap in practice. A single infection can be both a trojan and ransomware: the trojan is how it arrived, and ransomware is what it does. That is why security teams describe malware by both its entry method and its payload.
What are the main types of trojans?
Trojans are grouped by what they do after they run. Knowing the type helps you judge what may have been stolen and what to check first.
Banking trojans
Banking trojans watch for banking sessions, steal login details, or redirect payments. If you entered banking credentials after installing a suspicious app, treat the account as compromised until the bank confirms otherwise.
Backdoor trojans
A backdoor trojan opens a hidden channel so an attacker can return later, run commands, or install more malware. Because the attacker can come back, simply deleting the file is not enough: you must also check for persistence and changed settings.
Downloader and dropper trojans
These trojans exist mainly to fetch and install other malware. The file you ran may look harmless, while the real damage arrives minutes later as a second download.
Spyware and keylogger trojans
Spyware trojans record what you type, capture screens, or turn on a camera or microphone. If one ran, assume passwords typed during that period may have been captured.
Ransomware delivered as a trojan
Many ransomware infections arrive as a trojan: a fake invoice, a cracked program or a malicious attachment that, once opened, encrypts your files and demands payment. Ransomware is defined by what it does, not by how it arrived.
How do you know if you have a trojan or a virus?
No single sign proves an infection, but several together should prompt a full scan. Look for programs you did not install, browser home pages or search engines that change on their own, new toolbars, pop-ups, and security software that turns itself off.
- Performance changes: the device slows down, the fan runs constantly, or the battery drains fast for no clear reason.
- Network activity: high data use while you are idle, or connections to unfamiliar addresses.
- Strange behaviour: files appear, move or vanish, settings change, or friends receive messages you did not send.
- Blocked security tools: antivirus will not open, update or scan, which is a classic sign that malware is defending itself.
If you suspect an infection, do not keep using the device for banking or email. Disconnect it from the network first, then scan it. Our guide to how to know if your phone is hacked covers the same warning signs on mobile.
How do you remove a trojan or a virus?
Act in order: isolate, scan, remove, then repair the damage. Skipping the last step leaves stolen passwords and open backdoors in place.
- Disconnect from the network. Unplug ethernet and turn off Wi-Fi so the malware cannot send data out or download more payloads.
- Run a full scan. Use updated antivirus or antimalware software and run a full scan, not a quick scan. Quarantine everything it finds.
- Remove the malware and restart. Follow the scanner's removal steps, restart, and scan again to check the infection is gone.
- Change passwords from a clean device. Start with email, banking and cloud accounts. If a password was reused elsewhere, change it there too, and check whether it appears in known breaches with our pwned password checker.
- Check for persistence. Look for new user accounts, unknown startup programs, changed browser settings and new mail-forwarding rules.
- Update everything. Apply operating system and app updates, because many infections arrive through unpatched software.
- Restore from a clean backup if needed. If the infection keeps returning, or ransomware encrypted your files, restore from a backup made before the infection and do not pay the ransom.
How do you prevent trojans and viruses?
Prevention is mostly about breaking the two paths in: deception and infected files. Most infections need you to run something, so slowing down at that moment is the strongest control you have.
Use strong, unique passwords and turn on multi-factor authentication, so a stolen password alone does not hand over an account. Be extra careful with "free" versions of paid software, fake updates and urgent attachments — those are the most common trojan disguises.
For a wider starting point, work through our small business cybersecurity checklist, which covers updates, backups and device security alongside malware protection.
Many trojans arrive by email, so the same scepticism that stops spear phishing stops trojans too. McAfee's guide to viruses, worms, trojans and ransomware explains how the types differ, and Guard.io's virus vs worm vs trojan comparison sets out the same split by how each one spreads.
The bottom line
A trojan tricks you into running it; a virus infects your files and copies itself. The label tells you how it spread, not how much damage it can do, so treat both as serious and clean up thoroughly.
Disconnect the device, scan it fully, change passwords from a clean device, and keep backups so you can recover without paying anyone. You can start by checking whether a password you used was exposed in a known breach with the free pwned password checker.
Frequently asked questions
Is a trojan a virus?
No. A trojan is not technically a virus. A virus attaches itself to other files and copies itself when those files run, while a trojan is a standalone program that does not self-replicate and relies on you running it. People often say trojan virus, but the two terms describe different kinds of malware.
Which is worse, a trojan or a virus?
Neither is always worse, because the damage depends on the payload, not the label. A trojan that steals banking passwords can cost you more than a virus that corrupts a few files, and a virus that spreads across a network can cause wider disruption than a single trojan. Treat both as serious infections.
Can a trojan spread to other computers?
A trojan does not spread by itself, because it does not copy itself. It can still reach other computers if you share the infected file, if it downloads a worm, or if it steals credentials that an attacker uses to log in elsewhere. Containment still matters, even though the trojan itself does not replicate.
Can antivirus remove a trojan?
Yes, in most cases. Run a full scan with updated antivirus or antimalware software, quarantine what it finds, and follow its removal instructions. If the trojan opened a backdoor or stole passwords, also change your passwords from a clean device and check for new accounts, forwarding rules or unknown devices.
How do I know if I have a trojan?
Common signs include programs you did not install, browser settings that change on their own, pop-ups, slow performance, high network use when you are idle, and security software that is disabled. No single sign proves a trojan, so run a full scan if several appear together.
What is the difference between a trojan, a virus and a worm?
A trojan tricks you into running it and does not replicate. A virus needs a host file and copies itself into other files when the host runs. A worm copies itself across networks on its own, without a host file and usually without any action from you.
Can a Mac or phone get a trojan?
Yes. Trojans target Windows, macOS, Android and iOS, usually through fake apps, fake updates, cracked software and malicious attachments. Phones are most often hit through apps installed outside the official store or through fake apps that slip into it, so install apps only from trusted sources.
Sources
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.
Checked against McAfee's malware types guide, CyberDefenders' trojan guide and Guard.io's virus, worm and trojan comparison.
How we write and fact-check →