Malware & ransomware

What Is a Keylogger? How It Works, Types, Signs and Removal

A keylogger records every key you press and sends the log to someone else. Here is how it gets in, how to spot it, and how to get rid of it.

Cysoro Security TeamPublished · 9 min read
QWERTASDFGZXCREC ●● LOGGING EVERY KEY SOMEONE IS WATCHING MALWARE & RANSOMWARE What is a keylogger? Every keystroke, recorded.
Quick answer

A keylogger is software or a small hardware device that secretly records everything you type on a keyboard, including usernames, passwords and card numbers, and sends that log to someone else. Software keyloggers usually arrive through phishing emails or malicious downloads, while hardware keyloggers are physically plugged in between a keyboard and a computer. The best defenses are reputable anti-malware scans, phishing-resistant MFA such as passkeys, and a password manager.

Key takeaways

  • A keylogger records every keystroke and sends the log to an attacker, who can then reuse your passwords.
  • Software keyloggers arrive through phishing and bad downloads; hardware ones need brief physical access to your computer.
  • Passkeys and phishing-resistant MFA make a stolen password useless, which is the strongest defense against keyloggers.

Every password you type passes through your keyboard, and a keylogger sits in that path. It is one of the oldest forms of spyware, and it is still bundled into the commodity malware that criminals buy and spread through phishing emails today.

What is a keylogger?

A keylogger, short for keystroke logger, is software or a small hardware device that secretly records every key you press on a keyboard. The log is then stored for later collection or sent over the internet to whoever controls the keylogger.

NIST's Guide to Malware Incident Prevention and Handling (SP 800-83 Rev. 1) defines a keystroke logger as a tool that "monitors and records keyboard use", noting that some require the attacker to retrieve the data, while others "actively transfer the data to another host through email, file transfer, or other means".

The goal is almost always the same: your logins. Passwords, email addresses, card numbers, chat messages and search queries are all captured as plain text. You can read the full definition in NIST SP 800-83 Rev. 1.

MITRE ATT&CK, the framework security teams use to classify attacker behavior, lists keylogging as sub-technique T1056.001 under Input Capture (T1056), and calls it the most prevalent type of input capture.

It sits under two tactics at once: Collection, because it gathers data, and Credential Access, because it steals passwords.

How does a keylogger work?

A keylogger follows the same three steps wherever it runs: capture, store and deliver. The capture point decides which type you are dealing with and which check can find it.

  1. Capture. The keylogger copies each keystroke somewhere along the path from your keyboard to the app you are using: in the operating system, in the browser, or in the cable itself.
  2. Store. It saves the text in a hidden log file, in memory, or in the memory of a physical device.
  3. Deliver. Software keyloggers usually send the log out over the internet in small, regular batches. Many hardware keyloggers must be collected in person, so whoever planted one may return for it.

MITRE lists the concrete capture methods attackers use: hooking the API callbacks that process keystrokes, reading raw keystroke data from the hardware buffer, modifying the Windows Registry so the logger starts with the system, and installing custom keyboard drivers. An attacker may also clear your browser cookies to force you to sign in again, creating fresh passwords to capture.

How a keylogger attack works1CaptureHook, driver or devicecopies each keystroke2StoreHidden log file ordevice memory3DeliverSent to the attackeror collected in personThe attacker then reuses your passwords — often within hours.
Capture, store, deliver: the three steps of a keylogger attack. Illustration by Cysoro.

What are the types of keyloggers?

Keyloggers fall into two families, software and hardware, with several variants inside each. The type decides where it hides, which decides where you look for it.

TypeWhere it sitsHow it gets thereWhat finds it
API or hook softwareUser-space process, keyboard hookPhishing, bundled downloadsSecurity scan
Kernel or driver softwareDeep inside the operating systemMalware with high privilegesOffline scan or full reset
Form grabberBrowser or injected web codeMalicious extension, compromised pageExtension review
JavaScript loggerCompromised web pageInjected script on a checkout pageUnexpected script on the page
Inline hardwareBetween keyboard and USB portSomeone plugs it inLooking at the connection
Keyboard-embedded hardwareInside the keyboardTampering or a swapped keyboardReplacing the keyboard
Wireless snifferNear a wireless keyboardSomeone places it nearbyUsing a wired keyboard
Mobile keyboard or accessibility appReplaces the keyboardA permission you approvedPermission review

Software keyloggers

Most keyloggers are software. API-based loggers hook into the keyboard-handling functions inside the operating system and are the most common. Kernel-level loggers run as drivers with the same privileges as the operating system itself, which makes them far harder to detect and remove.

Form grabbers copy what you type into a web form the instant you hit submit, and JavaScript loggers injected into a compromised page do the same on checkout and login pages.

Real malware families use all of these. MITRE's procedure examples for Input Capture include Agent Tesla, which can log keystrokes on a victim's machine, Remcos, which has a dedicated keylogging command, and the APT41 keylogger GEARSHIFT. Banking trojans have long used form grabbing to capture credentials directly from the browser.

Hardware keyloggers

A hardware keylogger needs no software at all, so a software scan cannot see it. The most common form is a small inline adapter placed between a keyboard and a computer, but modified keyboards with a logging chip built in also exist. Because installing or retrieving one needs physical access, shared and public computers and open offices are the common settings.

Wireless keyboards add another variant: a sniffer placed within radio range can capture unencrypted keystrokes as they travel to the computer. Using a wired keyboard, or a wireless keyboard with proper encryption, removes that risk.

How does a keylogger get on your computer?

Software keyloggers almost always ride in on a more familiar threat. NIST notes that some phishing attacks install keystroke loggers to gather additional personal information, and that trojans install keyloggers and rootkits as part of a typical toolkit attack.

  • Phishing emails and texts. A malicious attachment or link installs the logger when you open it. This is the most common path by far.
  • Malicious or bundled downloads. Cracked software, fake updates and free tools from untrusted sites often carry a logger alongside the program you wanted.
  • Malicious browser extensions. An extension with broad permissions can read everything you type into web pages.
  • Unscanned USB drives. A drive left in a car park or handed out at an event can auto-run malware when plugged in.
  • Physical access. Someone with a few seconds alone at your desk can plug in a hardware keylogger or swap your keyboard.
  • Compromised websites. A hacked checkout or login page can run a JavaScript logger that captures what visitors type.

Our phishing email examples show the messages that deliver most of this malware.

Our spear phishing guide explains the targeted version aimed at specific people.

How do you know if you have a keylogger?

Keyloggers are built to hide, so there is rarely one obvious symptom. Look for a pattern of small oddities rather than a single smoking gun.

  • Unknown programs running. Check Task Manager or Activity Monitor for processes you do not recognize, especially ones that start with the system.
  • Antivirus disabled. If your security software is suddenly off, or you cannot open its settings, treat that as a serious warning.
  • High network traffic when idle. A device sending data while you are not using it may be uploading logs.
  • Unusual login activity. Password changes you did not make, sessions from places you have never been, or accounts locked after failed attempts.
  • Sluggish performance or strange behavior. Lag while typing, text appearing twice, or the mouse moving on its own can all be signs, though each has innocent causes too.
  • Something odd on the keyboard cable. An unfamiliar adapter between the keyboard and the computer is the hardware keylogger's signature.

For a technical check, MITRE notes that common keylogging API calls include SetWindowsHook, GetKeyState and GetAsyncKeyState, and recommends monitoring the Registry and file system for changes and watching for unexpected driver installs.

API calls alone are not proof of keylogging, but combined with new files on disk and unusual processes they are useful evidence. If you suspect an infection, stop signing in on that device and check your passwords with our pwned password checker from a different, clean device.

How do you remove a keylogger?

Act in this order. Speed matters, because every password you type on an infected device may be captured.

  1. Disconnect the device from the network. Unplug ethernet and turn off Wi-Fi to stop the log being sent out.
  2. Do not sign in to anything on that device. Use a different, clean device for every password change below.
  3. Inspect the keyboard connection. Follow the cable from the keyboard to the computer and look for an unfamiliar adapter. If you find one, photograph it, remove it, and report it to your IT team or the police if it was planted at work.
  4. Run a full anti-malware scan. Use your installed security software, then run an offline scan, which restarts the computer into a clean environment before the operating system loads.
  5. Check your extensions and installed programs. Remove anything you do not recognize, especially browser extensions with permission to read page content.
  6. Change your passwords from a clean device. Start with email, banking and your password manager, then work through the rest. Use unique passwords from a generator.
  7. Review account activity. Check for new forwarding rules in your email, unknown devices in your account settings, and sessions you do not recognize, then sign out of all sessions.
  8. If the infection persists, reset the device. A kernel-level logger may survive a scan. Back up your files, then reinstall the operating system from known-good media.

If the device belongs to your employer, tell your IT or security team first and follow their process instead of cleaning it yourself. They may want to preserve evidence. Our guide to knowing if your phone is hacked covers the same steps for mobile devices.

If you suspect a keylogger: do this first1. Disconnect from the network — stop the log leaving the device2. Stop signing in on that device — every password may be captured3. Inspect the keyboard cable for an unfamiliar adapter4. Run a full scan, then an offline scan5. Change passwords from a clean device — email and banking firstTreat every password typed on the device as stolen.
Five immediate steps when you suspect a keylogger. Illustration by Cysoro.

How do you prevent keyloggers?

No single control stops keyloggers. The goal is to make installation hard and to make a captured password useless.

  • Use passkeys or a security key. Passkeys are bound to the real website and are not typed, so a keylogger cannot capture them. FIDO's 2026 Passkey Index found that every participant that measures phishing reported fewer successful attacks after deploying passkeys.
  • Use a password manager and autofill. A manager types nothing: it fills credentials directly into the page, and it will not autofill on a fake domain.
  • Keep software updated. Install operating system, browser and app updates promptly, since many keyloggers arrive through vulnerabilities that already have fixes.
  • Run reputable anti-malware and keep it on. Real-time protection catches known keylogging malware before it runs.
  • Be careful with downloads and extensions. Get software only from the vendor or an official store, and review browser extension permissions regularly.
  • Lock your screen and your desk. Hardware keyloggers need physical access. Lock your computer when you leave it, and do not leave it unattended in shared spaces.
  • Check shared computers before use. On a hotel, library or hot-desk computer, glance at the keyboard cable before typing a password.

For a wider starting point, our small business cybersecurity checklist covers anti-malware, updates and MFA alongside backups and device security.

You can test your own awareness with our free phishing quiz.

It depends on who installs one, on whose device, and with what consent. Installing a keylogger on someone else's device without their permission is illegal in most countries, and using one to steal credentials is fraud and identity theft.

There are narrow legal uses. An employer may monitor company-owned devices if the monitoring is disclosed in a clear policy and local law allows it. Parents may use monitoring software on a child's device. Law enforcement may use keylogging tools under a court order. In each case the key factor is lawful authority and consent, not the software itself.

If you find a keylogger on a work computer, do not remove it yourself and do not confront anyone. Report it to your IT or security team and let them handle it, since it may be evidence in an investigation.

The bottom line

A keylogger is simple technology with serious consequences: everything you type, including the passwords that protect your email and bank accounts, ends up in someone else's hands. Software versions arrive through phishing and bad downloads, hardware versions need a few seconds of physical access, and both are hard to spot once installed.

The strongest defense is to make a stolen password useless. Move to passkeys where sites offer them, use a password manager with autofill, keep your software updated, and check the keyboard cable on any computer you do not own.

If you think you are infected, disconnect, inspect, scan, and change your passwords from a clean device. You can check whether your passwords are already exposed with the free pwned password checker.

Frequently asked questions

What is a keylogger in simple terms?

A keylogger is a program or small device that secretly records everything you type on a keyboard, such as passwords, messages and card numbers, and sends that record to someone else. It runs without any visible window or warning.

How do I know if I have a keylogger?

Common signs are unknown programs running, your antivirus being disabled, high network traffic when the device is idle, strange login activity on your accounts, and your computer behaving slowly. A full anti-malware scan and a physical check of the keyboard cable are the most reliable checks.

Can antivirus detect a keylogger?

Usually, yes, for known software keyloggers: reputable anti-malware tools detect common keylogging malware and the API calls it uses. Kernel-level loggers and hardware keyloggers are harder, which is why an offline scan and a physical inspection of the keyboard connection matter too.

Can a keylogger steal passwords from a password manager?

A keylogger records what you type, so it can capture a master password typed on an infected device, and any password you type manually. It cannot read the encrypted vault itself. Using passkeys or a security key to unlock the vault, and autofilling instead of typing, reduces the risk.

Are keyloggers illegal?

Installing a keylogger on someone else's device without their permission is illegal in most countries, and using one to steal credentials is fraud. Keyloggers can be legal in narrow cases, such as an employer monitoring company-owned devices with clear disclosure, parental controls, or law enforcement acting with a warrant.

Can a keylogger work on a phone?

Yes. On phones, keylogging usually comes from a malicious keyboard app, an app abusing accessibility permissions, or spyware installed by someone with physical access. Only install keyboards from official app stores, review accessibility permissions, and keep your phone locked.

Does a keylogger work if I use two-factor authentication?

It depends on the second factor. A keylogger can capture a one-time code you type, and modern phishing kits relay codes in real time. Passkeys and hardware security keys are not typed and cannot be captured this way, which is why they are the strongest defense.

Sources

  1. NIST SP 800-83 Rev. 1 — Guide to Malware Incident Prevention and Handling
  2. MITRE ATT&CK — Technique T1056: Input Capture
  3. FIDO Alliance — 7 Billion Passkeys and Counting
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against NIST SP 800-83 Rev. 1, MITRE ATT&CK T1056 and the FIDO Alliance Passkey Index 2026.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free