Also called a keystroke logger, a keylogger is software or hardware that monitors and keeps a record of the keyboard keys an unsuspecting user presses. The malicious user who installed the program or hardware device can later view the record (log) to view what was typed by the target user. Because these programs and hardware devices monitor the keys typed in, a user can find user passwords and other information a user may not want others to know. The picture is an example of what a hardware PS/2 and USB keyboard keylogger. These keyloggers attach between the keyboard and the computer.
A hardware keylogger can connect to the back of a computer, often without a user knowing about them, and then be disconnected to collect all logged information.
If you're concerned about privacy or have sensitive data, consider anti-keylogger protection software that is designed to prevent and stop hardware and software keyloggers.