scanrootkit

What Is a Keylogger? Software and Hardware Keyloggers Explained

A keylogger records what you type. Every password, card number, private message and search goes into a log that someone else can read. NIST defines a key logger as a program “designed to record which keys are pressed on a computer keyboard used to obtain passwords or encryption keys and thus bypass other security measures.”

Keyloggers come in two broad forms, software and hardware, and they are defended against in different ways. This guide covers both, how they get onto a device, how to look for them, and the habits that make a keylogger far less useful even if one does get in.

Software keyloggers

A software keylogger is a program running on your computer or phone. It captures keystrokes through the operating system and sends the log to whoever installed it, by email, upload or a connection back to a server.

They range from simple to sophisticated:

Type How it captures input Typical source
Keyboard hook Asks the operating system to be notified of every key press Commodity malware, “monitoring” software
Form grabber Reads what you submit in web forms inside the browser, before it is encrypted Banking trojans
Screen and clipboard capture Takes screenshots or reads copied text, catching pasted passwords Remote access trojans, spyware
Kernel-level Intercepts keyboard data inside the operating system Rare, more advanced malware, sometimes paired with a rootkit
Mobile Abuses Android Accessibility permissions, or replaces the keyboard app Banking trojans, stalkerware

Many keyloggers are not standalone. They are one feature of a remote access trojan, which CISA describes as software that allows remote administrative control and can be used to “install backdoors and key loggers, take screen shots, and exfiltrate data.”

Some keylogging software is sold openly as parental control or employee monitoring. Installed on someone else’s device without their knowledge, it is stalkerware, and in many places it is illegal.

Hardware keyloggers

A hardware keylogger is a physical device. The most common is a small plug that sits between a USB keyboard and the computer, recording everything typed into its own memory. Others are built into a keyboard cable, a fake keyboard, or a device fitted inside a keyboard.

Because it runs outside the computer, no antivirus or operating system can see it. The attacker needs physical access twice, once to fit it and once to collect it, unless it sends data wirelessly. That makes hardware keyloggers a risk mainly for shared and public computers: libraries, hotels, internet cafes, open-plan offices and reception desks.

Card skimmers on cash machines and fuel pumps are a close relative, capturing PIN entry with an overlay keypad or a hidden camera.

How software keyloggers get installed

How to detect a keylogger

There are rarely obvious symptoms. A well-built keylogger does not slow the machine or show any window. Detection comes from scanning and from checking the places keyloggers have to use.

On Windows

  1. Run a full scan in Windows Security, then a Microsoft Defender Offline scan. The Windows rootkit guide has the exact steps.
  2. Get a second opinion with a different vendor’s scanner, such as the free Malwarebytes.
  3. Use Microsoft’s free Sysinternals Autoruns to review what starts automatically, with Microsoft entries hidden and the VirusTotal check on. Keyloggers need to restart after every reboot, so they appear here.
  4. Review browser extensions in every browser you use and remove anything you did not install on purpose.

On a Mac

macOS requires apps to be given Input Monitoring permission to watch your keyboard while you use other apps. Check System Settings > Privacy & Security > Input Monitoring and switch off anything you do not recognise. Also review Accessibility in the same section.

Objective-See’s free ReiKey tool scans for keyboard event taps, the mechanism Mac keyloggers commonly use. The Mac guide covers the rest of the check.

On Android

Look at Settings > Accessibility for installed services, and at your keyboard settings for any keyboard app you did not choose. Accessibility access lets an app see what is on screen and act for you, which is exactly what a mobile keylogger needs. More on this in the Android guide.

For hardware keyloggers

Look. Follow the keyboard cable to the computer and check for any small adapter or plug between the cable and the port that should not be there. On a desktop, check the back panel as well as the front. On a shared or public computer you cannot inspect, assume the worst and do not type anything important.

How to protect yourself

You cannot guarantee a keylogger never reaches a device. You can make sure it captures very little of value.

Stop typing passwords

A password manager that fills in logins automatically means your passwords are never typed, so a basic keystroke logger never sees them. It also refuses to fill a password on a lookalike phishing site, which helps against the same attackers. You still type the master password, so make it long and unique and protect the account with two-factor authentication.

Use two-factor authentication everywhere it matters

With two-factor authentication on, a stolen password alone is not enough to sign in. Start with email, because it can reset every other account, then banking, cloud storage and social media.

Not all second factors are equal. Codes sent by SMS or typed from an app can be captured and used within seconds by more advanced malware. CISA’s guidance is that FIDO/WebAuthn authentication, which includes hardware security keys and passkeys, “is the only widely available phishing-resistant authentication.”

Switch to passkeys where offered

A passkey replaces the password with a cryptographic key stored on your device, unlocked with your fingerprint, face or device PIN. There is no secret for you to type, so there is nothing for a keylogger to record and reuse elsewhere. Malware in full control of a device can still act within a session you have already opened, so a passkey limits the damage rather than making an infected computer safe.

Keep the basics in place

For broader habits around accounts, tracking and data exposure, MK Library’s guide to protecting your privacy online is a good companion to this one.

If you find a keylogger

  1. Disconnect the device from the internet.
  2. From a different, clean device, change the passwords for email, banking and any account you signed into recently, and sign out all other sessions.
  3. Remove the keylogger with your security software, then run an offline scan to check nothing else is hiding. If it came with a rootkit or keeps returning, a wipe and reinstall is safer. See how to remove a rootkit.
  4. Watch bank and card statements and turn on login alerts where your accounts offer them.
  5. If you believe someone you know installed monitoring software on your phone to track you, take care before removing it, since they may notice. Contact a domestic abuse support service for advice on doing it safely.

For a broader step-by-step check of a computer or phone, see how to check for malware.

Frequently asked questions

What is a keylogger?
A program or device that records the keys pressed on a keyboard. NIST defines it as a program designed to record which keys are pressed, often to obtain passwords or encryption keys. Criminals use them to steal logins and payment details. Some are sold openly as monitoring software.
Can antivirus detect keyloggers?
Antivirus detects most known software keyloggers, including ones bundled with remote access trojans. It cannot detect a hardware keylogger plugged between the keyboard and the computer, because that device is invisible to software.
Do password managers protect against keyloggers?
Partly. A password manager that fills passwords automatically means you do not type them, so a simple keylogger never sees them. Your master password is still typed, so protect that account with two-factor authentication.
Do passkeys stop keyloggers?
A passkey never involves typing a secret, so there is nothing for a keylogger to capture and replay. Malware with full control of a device can still misuse an active session, so passkeys reduce the damage rather than replacing a clean device.
Can a phone have a keylogger?
Yes. On Android, malicious apps usually capture input by abusing Accessibility permissions or by replacing the keyboard app. Check both settings and remove anything you do not recognise.