All articles Advanced signals

Keystroke Dynamics for Fraud Detection

The way you type is a habit your fingers formed over years. The gaps between keystrokes, how long you hold each key, the rhythm of common letter pairs, and the pauses where you think are all remarkably consistent for a given person on a given keyboard, and remarkably hard to imitate. Keystroke dynamics turns that rhythm into a behavioral signal that can tell a returning human from an imposter, and a human from a bot that pastes or types with machine regularity.

It is a subtle signal with real limits, and it is easy to over-claim. This article explains the timing features that carry the signal, where it works in fraud detection, where it fails, and how to collect it without recording what people actually write.

The timing features that matter

Keystroke dynamics is built almost entirely from event timing, not content. Two families of measurement do most of the work.

  • Dwell time. How long a key is held down, the gap between keydown and keyup for the same key. People have stable dwell distributions.
  • Flight time. The gap between releasing one key and pressing the next. This captures the rhythm of moving between keys.
  • Digraph and trigraph latency. Timing across common two- and three-key sequences, like the transition from t to h to e. Frequent sequences are the most stable and discriminative.
  • Error and correction patterns. How often and how someone backspaces and re-types.

None of these require knowing which characters were typed in the sense of storing text. You need the identity of the key for digraph timing, but you do not need to persist the message. That distinction is what makes the signal compatible with data minimization for fraud signals.

What the signal is good at

Keystroke dynamics shines in a few specific fraud contexts, and understanding which ones prevents overreach.

Use caseFitWhy
Human vs bot at formsStrongBots paste or type with unnatural regularity
Continuous authenticationGoodRhythm persists through a session
Imposter after takeoverModerateNew typist diverges from the account owner
Cold identification of a strangerWeakNo baseline to compare against

The strongest, most reliable use is separating humans from automation. A bot filling a login form either pastes values instantly or emits keystrokes with metronome-like spacing that no human produces. That contrast pairs naturally with mouse movement bot detection and the broader behavioral biometrics toolkit. For imposter detection after an account takeover, a typing profile that suddenly diverges from the account’s established rhythm is a useful step-up trigger.

A simple feature extraction

Collecting the raw material is straightforward in the browser. The client records timing, not text, and the server compares distributions.

const events = [];
input.addEventListener('keydown', e => {
  events.push({ type: 'down', key: e.code, t: performance.now() });
});
input.addEventListener('keyup', e => {
  events.push({ type: 'up', key: e.code, t: performance.now() });
});

// Derive features, discarding the actual characters
function features(events) {
  const dwell = [];   // keyup - keydown per key
  const flight = [];  // next keydown - previous keyup
  // ... pair up events by key, compute deltas ...
  return { meanDwell: mean(dwell), meanFlight: mean(flight),
           dwellVar: variance(dwell), flightVar: variance(flight) };
}

Note two things. The features use e.code for pairing but the pipeline never stores the typed string. And variance matters as much as the mean: a human has natural variability, while automation is often suspiciously low-variance. A flight-time variance near zero is a bot tell in itself.

The limits you must respect

Keystroke dynamics degrades in conditions that are common in real traffic, and ignoring these limits produces false positives.

  • Device dependence. A profile built on a laptop keyboard does not transfer to a phone touchscreen. Compare like with like.
  • State dependence. Fatigue, injury, distraction, and even a different chair change someone’s rhythm.
  • Cold start. With no baseline, you cannot verify a first-time user against themselves.
  • Short inputs. A four-character PIN gives too little timing data to be reliable. The signal needs enough keystrokes to stabilize.

Because of these, keystroke dynamics belongs in a weighted score, never as a standalone gate. Treat a divergent typing profile as one reason among several, and lean on the strong case (human versus machine regularity) more than the weak case (identifying a specific stranger). This is the same discipline that governs reducing false positives in fraud detection.

Collecting it responsibly

Behavioral biometrics is sensitive precisely because it describes a person’s body, so collection has to be deliberate.

  1. Capture timing only, never the content of what is typed.
  2. Store derived features, not raw keystream logs, and set short retention.
  3. Disclose the collection and its purpose, in line with GDPR device fingerprinting.
  4. Use the signal to reduce friction for genuine users, not only to challenge, so the exchange is fair.

Prynt includes behavioral biometrics as part of its signal set, folding typing and pointer rhythm into a sealed result that never exposes raw input to your application. See how it fits the wider picture on the device fingerprinting page and in the docs.

Frequently asked questions

Can keystroke dynamics identify a specific person?

It can distinguish users with useful accuracy in controlled settings, but it is better treated as a corroborating signal than a sole identifier, because typing varies with device, mood, and fatigue.

Do keystroke dynamics require capturing what users type?

No. Effective keystroke biometrics use only timing between key events, not the characters themselves, so you can build the signal without recording the content of what someone types.

Keystroke dynamics reads the rhythm behind typing, and that rhythm is genuinely hard to fake and easy to distinguish from machine input. Use it where it is strong, respect its device and state dependence, weight it into a broader score, and collect only timing. Done that way, it adds a layer of behavioral confidence that pure environment fingerprints cannot.

Run it yourself

Prynt is open-source, self-hostable device intelligence — visitor IDs, bot & fraud Smart Signals, and behavioral biometrics you own end to end.

Keep reading