Malware is a program or code created to do harm to a computer. A virus is a type of malware that copies itself in order to spread to other devices.