The worm is a standalone malicious program which spreads from computer to computer, but unlike a virus, it has the capability to travel without any human action. A worm takes advantage of file or information transport features on the system, which is what allows it to travel unaided. Often, it uses a computer network to spread itself, relying on security failures on the target computer to access it.
Difference between Worms and Viruses
A virus is a program that replicates, i.e. it spreads from file to file on your system
It may be programmed to erase or damage data.
A virus is a set of code which adds itself to existing files.
A worm is a malicious program that originates on a single computer and searches for other computers connected through a local area network or Internet Connection.
When a worm finds another computer, it replicates itself onto that computer and continues to look for other connected computers on which to replicate.
A worm continues to attempt to replicate itself indefinitely or until a self-timing mechanism halts the process.
It does not infect other files.
A worm code is a stand-alone code. In other words, a worm is a separate file.