What are keyloggers?

A close-up photograph of a person's hands typing on a backlit laptop keyboard
(Image credit: Getty Images)

You've likely heard of various types of malware that threaten your privacy, but one of the most prevalent forms of spyware out there are keyloggers. A keylogger silently operates on your computer, recording every keystroke you make and transmitting sensitive information such as passwords to a hacker.

It's important to be aware of keylogging because even if you use cybersecurity tools like the best VPN to try and protect your data, they can still compromise your privacy and security in a way that’s very difficult to recover from.

This article is a guide to all things keylogger, from what exactly they are, to how they work and how they target your devices specifically. This knowledge is key to defending against keyloggers, so read on for more information on how to keep safe from this data-stealing malware.

A hand typing at a computer in a dark room, lit up by the laptop's keyboard LEDs and red LED light

(Image credit: Getty Images)

What is keylogging?

Keylogging is when the keystrokes you make on your keyboard are recorded by a third party, for example a hacker. Every time you press a button on your keyboard, you’re sending a keystroke to your computer. This sends a signal to your computer, which its operating system records and acts upon.

This is important to remember when we talk about software and hardware keyloggers, but you should know that anything you type on your computer has to be processed inside it, and therefore can be stolen by a keylogger.

There’s two different but related concepts at play here. The first is keystroke logging, which is the actual act of recording anything you type on your computer. Keystroke logging can be carried out in a few different ways, which brings us on to the second concept, keylogging tools. These are the actual methods that someone uses to record your keystrokes.

Since keystrokes are mainly how you interact with your computer, keyloggers give hackers information about basically everything you do on your computer.

Since keystrokes are mainly how you interact with your computer, keyloggers give hackers information about basically everything you do on your computer. In turn, this ends up compromising your passwords, your bank account details, your private conversations, literally everything that you type.

While keyloggers are often used as spyware for malicious purposes, they can also have legitimate applications. There’s a lot of parental control software out there that gives you the ability to record keystrokes, capture screens, and enable a device’s microphone or camera in order to check what your child is getting up to on their computer.

Some workplaces also use these tools (also known as bossware) to look at what their employees are doing on the clock, however it's important to note that this is illegal to do without letting their employees know that they’re being surveilled.

A person typing on a computer, lit up by the screen

(Image credit: Getty Images)

How does keylogging work?

There are two different types of keyloggers you’ll encounter. Both are kinds of spyware that can be used to steal your data, but the way they work is different. First, let’s go over software-based keyloggers.

Software-based keyloggers can be installed remotely without directly accessing the device they're downloaded on. Once installed, they use sophisticated malware techniques to run without the victim's knowledge or permission. This then allows the hacker to silently collect your keystrokes in the background, passing them back to themselves over email or via an encrypted channel.

Hardware-based keyloggers, on the other hand, require physical access to your computer. These devices are typically inserted between the keyboard and the computer to intercept signals. It acts as a “virtual” keyboard, recording keystrokes while also relaying them to the computer so you don't notice that there's anything amiss. From a computer’s perspective, there’s no difference between your real keyboard and the virtual keyboard that the hardware keylogger gives it.

This means it’s much harder for a computer system to automatically detect a hardware keylogger. Thankfully, you’re most likely not going to encounter a hardware keylogger in your home. If anywhere, they’re going to be installed in a public place or potentially installed on a work computer.

If you’re worried about hardware keyloggers specifically, I recommend using an OS-based virtual keyboard. This is because the keystrokes generated by this type of keyboard aren’t being generated on the keyboard, and instead are skipped altogether. However, this isn't a fool-proof defense from all keyloggers. Software based keyloggers will still pick up on the keystrokes you create, and usually they come with screenshotting software which records your screen too.

The only foolproof way to defend against a hardware keylogger is to actually physically inspect your device for any extra connections you don’t recognize.

A person typing on a laptop, bathed in blue light

(Image credit: Getty Images)

How can I avoid keylogging software?

You should take the same approach to avoiding keylogging software as all other malware.

Rule number one: don’t click on unknown or suspicious links, especially in unsolicited emails or messages. Hackers will often use the contact books of their victims to send malware to their friends and family on the basis that they’re more likely to trust the email.

You also shouldn’t download software unless you’re sure it’s from a trusted vendor. Even if you’re only downloading software through an app store like Google Play, there’s still plenty of malware lurking out there that masquerades as perfectly innocent software. There’s too many red flags to point out here, but free software that requests excessive permissions unrelated to the app is usually the number one sign something is wrong.

You should take the same approach to avoiding keylogging software as all other malware.

It’s pretty tiresome being suspicious of every single thing being sent to your inbox, though. Inevitably, there’s going to be a day where you end up accidentally clicking something you didn’t mean to or open an attachment without thinking about it too much. You need an anti-virus solution that’s going to have your back when this happens, which is why I’d recommend you’d check out NordVPN’s Threat Protection Pro.

Created by the same company behind the best VPN on the market, Nord, Threat Protection Pro builds on the anti-malware blocklist built into its basic threat protection Threat Protection. It adds in deeper ad-blocking, malware scanning, and a URL scanner that proactively protects against phishing attempts to keep you safe from any hacking attempts.

This is all built on top of NordVPN’s existing VPN infrastructure which protects your IP and encrypts your browsing traffic, hiding your data from your ISP and hackers alike. In addition to protecting you against keylogging, Threat Protection Pro protects you from a range of online threats in a single software package.

Sam Dawson
VPN and cybersecurity expert

Sam Dawson is a cybersecurity expert who has over four years of experience reviewing security-related software products. He focuses his writing on VPNs and security, previously writing for ProPrivacy before freelancing for Future PLC's brands, including TechRadar. Between running a penetration testing company and finishing a PhD focusing on speculative execution attacks at the University of Kent, he still somehow finds the time to keep an eye on how technology is impacting current affairs.

With contributions from
Read more
A person typing on a computer while hackers use phishing to steal a file from their computer
It's Safer Internet Day – here are 5 tips to help you be safer online
Mobile malware
New malware uses infected VPN apps to take over your device — here's how to stay safe
VPN app on mobile phone
Are VPNs safe?
Black and white photo of a woman, with her eyes obscured by pixels
It's Data Privacy Day – 4 ways to protect your info online
Green switch in the On position on a pastel yellow background
What is a VPN kill switch, and why do you need one?
What is a VPN?
What is a VPN?
Latest in Online Security
and image of the Google Chrome logo on a laptop
Google Chrome at risk from shape-shifting browser extensions — how to stay safe
Green skull on smartphone screen.
Over 1 million Android devices infected with password-stealing, pre-installed botnet malware — how to stay safe
Android 12
Google March Android Security Update fixes two high severity vulnerabilities — update now
An Android bot next to an Android TV remote
Millions of Android TVs hijacked in massive botnet — how to see if yours is at risk
Poster of Elon Musk saying "I am stealing from you"
Elon Musk's DOGE blocked from accessing your data – and 3 in 4 Americans agree
A fake text message on a smartphone being held by both hands.
Toll road scams are worse than ever — what to look for and how to stay safe
Latest in Features
Nothing Phone 3a Pro vs Pixel 8a.
I shot over 200 photos with the Nothing Phone 3a Pro vs Pixel 8a — here’s the winner
Man in a low squat with arms extended at shoulder height during gorilla walk exercise
Mobility coach shares 'squat like a baby' routine to boost lower-body flexibility and improve hip health
The Silent Beacon Bluetooth panic button worn on a wrist next to a Fitbit
I tried a physical panic button for 48 hours — and this tiny device already makes me feel safer
A woman with long dark hair sits up in bed with her arms stretched in the air as sunlight streams in through her open curtains
You lose an hour of sleep this weekend, here’s why that’s a good thing
the dyson airwrap ID in teal and terracotta colorway (patina and orange) with a lapis case, with a brush, hairfryer, curling wand attachments
I’ve ruined my hair with 3 years of perms — but the new Dyson Airwrap ID saved my locks
Apple Watch Ultra 2 on a black silicone strap and Amazfit T-Rex 3 on an orange silicone strap shown side-by-side on a user's wrist
I walked 10K steps with Apple Watch Ultra 2 vs Amazfit T-Rex 3 — and this one was more accurate