Hardware refers to the physical parts of a computer system that can be touched or seen, such as the keyboard, mouse, screen, and plastic casing. Software, on the other hand, is the virtual component that consists of code and instructions for the computer to perform tasks. Firmware is a specific type of software that provides low-level control for hardware components. Peripherals are external devices connected to the computer to provide additional functionality.