Keyloggers can exist in both hardware and software forms, with both types designed to record keystrokes.