Malware and viruses are often used interchangeably because both have overlapping features. But they are not the same. Here is the clear definition and working of each of the programs:
Malware is software that is designed to infect a system or device using different types of malicious programs. It is a catch-all term that includes all types of malicious programs, for example, spyware, ransomware, viruses, adware, worms, trojans, viruses, etc. These malicious programs exploit cyber security vulnerabilities in your network to enter your system. Once in your system, they start stealing your personal information, modifying programs, displaying unwanted ads, taking control of the system, and preparing ransomware attacks.
On the other hand, the virus is a specific type of Malware that self-replicates itself, inserting its code into key operating areas.  After this, It spreads into the system by attaching itself to legitimate files and programs. It can also sneak into your system through virus-injected websites, emails, flash drives, etc. When you open a file or application from those websites, these malicious programs become active. It starts encrypting files, modifying programs, or disrupting computer operations as soon as it is active.