A computer virus is a type of malware that is a program or piece of code that is loaded onto a person's computer without his knowledge and runs against his wishes. A computer virus is malicious code that replicates by copying itself to another program, computer boot sector or document and changes how a computer works.