A virus is a piece of code that is created to interfere with the normal functioning of a computer system. Viruses can spread rapidly and trigger considerable damage to both individual computers and networks. Some viruses are harmless, while others can delete files, corrupt data, or even damage hardware.