Keystroke dynamics: Digital biomarkers of stress and alertness

ArticleDetailDownload PDF
It has been established that the timing of keystroke presses when we type is correlated with our levels of alertness and stress and can therefore be used as a digital biomarker for stress levels. Professor Alan Smeaton and his research team at Dublin City University, Ireland, have examined keystroke dynamics on keyboards and smartphones while also measuring the participants’ heart rate variability to identify and collect physiological data. The research team performed a detailed analysis and correlated keystroke time variations with variations in heart rate variability to explore the relationship between keystroke dynamics and the subjects’ emotional state.

People gather digital data about themselves all the time – to monitor sleep, count daily steps or record weight. This automatic gathering of digital data in everyday life is known as lifelogging. Lifelogging generally requires wearable devices such as wrist-worn accelerometers or non-wearables such as weighing scales. While most low-level lifelogging is small scale, we can increase the amount we record about ourselves by using more devices, for instance location trackers, heart rate monitors, galvanic skin monitors for stress, logging food and drink intake, voice monitors and wearable cameras that face outwards and document our day. In addition to ambient sensing, with sensors that collect data on environmental changes such as temperature and lighting, we can have environmental sensors in our homes to log where we are and what we are doing. All our online activities are logged by third parties, the internet companies. A lot of our lives can be logged by others monitoring us, and us monitoring ourselves.

Keystroke dynamics refers to the patterns of rhythm and timing when we type keys on keyboards, tablets and smartphones. The time gap between one character typed and the next character is measured in milliseconds and can be easily captured by a computer. Dr Alan Smeaton, Professor of Computing and Founding Director of the Insight Centre for Data Analytics at Dublin City University, together with his postgraduates Naveen Garaga Krishnamurthy, Amruth Hebbasuru Suryanarayana, Meenu Mathew, Srijith Unni and Sushma Suryanarayana Gowda, is analysing keystroke dynamics data as digital biomarkers of stress and alertness.


Keystroke dynamics
Professor Smeaton explains that in addition to capturing the time between keystrokes, we can also record both the dwell time (the time in milliseconds that a key is physically pressed by the user’s finger on the surface of the phone) and the flight time (the time taken for the finger to ‘fly’ from one key to the next) using a smartphone. Capturing keystroke dynamics is free, no additional equipment is required, and the process is non-intrusive.

Everyone’s keystroke dynamics are unique as we all key different timing patterns when we type. Keystroke dynamics are so unique that their original application was in user authentication, verifying the user’s identity while they typed. Although this concept has been around since 1980, companies such as TypingDNA are only now offering systems to authenticate users as they are typing.

Keystroke logging has other applications besides authentication. It has been used in the identification of different kinds of author writing strategies and understanding cognitive processes, as well as measuring levels of stress and emotional state. Keystroke dynamics have also been explored in relation to Parkinson’s disease, mood disorders and cognitive performance. These studies revealed associations between clinical measures and typing behaviour.

Keystroke dynamics have been explored in relation to Parkinson’s disease. Kateryna Kon/

Digital biomarkers
Recently, researchers have found that keystroke dynamics gathered over the long term can be used as a form of digital biomarkers. For example, researchers have investigated the use of keystroke dynamics to assess clinical aspects of multiple sclerosis (MS). Keystroke data were captured during participants’ regular use of their own smartphones, facilitating the frequent assessment of health status unobtrusively from a remote distance in real-time. The researchers found moderate correlations between the keystroke measures and clinical disability, manual dexterity and information-processing speed in patients with MS. Consequently, keystroke dynamics are a promising biomarker for clinical disability in MS. This research opens the door for new applications of keystroke dynamics in disease monitoring, patient management and outcomes for clinical trials.

A data source for lifelogging
Professor Smeaton and his research team present the case for keystroke logging as a data source for lifelogging. They have been examining keystroke dynamics on keyboards and, more recently, on smartphones, because it has been established that the timing of keystroke presses when we type is correlated with our levels of alertness and stress. The basis for this research is that keystroke dynamics can be analysed in real-time, enabling the research team to compare the observed timing information, as it is keyed into the smartphone, with the user’s unique individual baseline timing information. The deviations are measured and used as a digital biomarker for stress levels.

“Researchers have found that keystroke dynamics gathered over the long
term can be used as a form of digital biomarkers.”

The researchers have gathered keystroke dynamics data from smartphones and from laptops using Loggerman, a comprehensive logging tool that can capture keyboard, mouse and interface actions. This information is collected ambiently and stored in log files on the local computer. Examining the Loggerman files, the researchers observed that participants regularly made use of autocomplete. When they made typing errors, they would then use backspace or reposition their cursor to fix a spelling error or change a mistyped word. The number of fully and correctly typed words in Loggerman’s word file is therefore lower than the researchers anticipated.

Pixels Hunter/

In addition to keystroke logging, the researchers also used a Scosche RHYTHM24 fitness band to measure participants’ heart rate variation. The research team performed a detailed analysis and correlated keystroke time variations with variations in heart rate variability, to explore the relationship between keystroke dynamics and the emotional state of the subjects as represented by their heart rate variation.

A plethora of information
When applying machine learning and artificial intelligence techniques to the analysis of keystroke dynamics data, there is so much information available from the timing information that it is not clear which features should be used to describe keystroke dynamic data. For this reason, the researchers focused on the timing information between adjacently typed keys, known as bigrams. In particular, they paid attention to the most commonly occurring bigrams in normal, everyday English language, such as TH, HE and IN, rather than the rarely occurring bigrams like XD, BV and JW.

Professor Smeaton and his team analysed the timing information associated with keystrokes. This demonstrated how timing information between bigram keystrokes for individual participants can vary across different days. It also shows how the relative speeds with which bigrams are typed varies hugely, both for the same participant and across different participants. This illustrates how useful keystroke dynamics can be for security and authentication applications.

Future work
To date, the research team has advocated the use of keystroke dynamics. Professor Smeaton explains that the trajectory of their work is to demonstrate how this ambient source of data on a person, the timing of their keystroke presses, is actually a digital biomarker of the person’s stress level and alertness. He discusses the range of ways in which data from keystroke dynamics could be used as part of a lifelog. A particular interest is using keystroke timing information to gain insights into the more complex cognitive processes we engage in every day. Keystroke dynamics, especially on mobile devices, offer potential for further exploration to discover correlations with stress, cognitive load from multi-tasking, fatigue and distraction.


What future extensions of your approach to keystroke dynamics could further enhance its applicability as a digital biomarker?

The most desirable next step is, of course, gathering more data. Anybody working in machine learning and data analytics will always need more data, so more participants and long-term keyboard logging would be very welcome. Second would be a realisation that gathering timing information associated with keystrokes is not a threat to privacy or data ownership. So much of our world is haunted by people’s fears about their data being abused and mis-used. Like many forms of lifelogging, keystroke dynamics can be gathered in ways which do not threaten your privacy but can offer direct benefit back to the participant. If we accept that fact, then this concept of keystroke timing has a future in our lives.



  • Smeaton, AF, Krishnamurthy NG, Suryanarayana AH, (2021). Keystroke Dynamics as Part of Lifelogging. In: Lokoč J, et al. (eds) MultiMedia Modeling. MMM 2021. Lecture Notes in Computer Science, 12573. Springer, Cham. Available at:
  • Unni, S, Gowda, SS, Smeaton, AF, (2021) An Investigation into Keystroke Dynamics and Heart Rate Variability as Indicators of Stress. arXiv [forthcoming]. Available at:
  • Gurrin, C, Smeaton, AF and Doherty, AR, (2014). LifeLogging: Personal Big Data. Foundations and Trends® in Information Retrieval, 8(1), 1–125. Available at:
  • Lam, KH, Meijer, KA, Loonstra, FC, et al, (2021) Real-world keystroke dynamics are a potentially valid biomarker for clinical disability in multiple sclerosis. Multiple Sclerosis Journal, 27(9), 1421–1431. Available at:

Research Objectives

Professor Smeaton is analysing keystroke dynamics data as digital biomarkers of stress and alertness.


Research supported by Science Foundation Ireland (SFI) under Grant Number SFI/12/RC/2289_P2, co-funded by the European Regional Development Fund.


Alan Smeaton is Professor of Computing at Dublin City University (DCU) and a founding Director of the Insight Centre for Data Analytics at DCU. He is an elected member of the Royal Irish Academy and an Academy Gold Medal winner, a Fellow of the Institute of Electrical and Electronics Engineers and a major contributor to the field of multimedia analysis and retrieval.

Alan Smeaton

Insight Centre for Data Analytics
Dublin City University
Glasnevin, Dublin 9

T: +36 26 393129
Twitter: @asmeaton

Related posts.


Leave a Comment

Your email address will not be published.

Share this article.