Hardware is a physical device that is tangible in nature, helps the computer to function, and is not affected by a Virus, Whereas Software is a set of programs that is not tangible and is in the form of code, it does get affected by a Virus.
Hardware is generally made of electrical components whereas software is written or developed using coding languages.
Hardware can get wear out over time but the software does not, though it can be affected by glitches and bugs.