# How Far Do Your Fingers Travel When Typing?

I was browsing Twitter the other day and I came across this tweet:

I found it hard to believe that my fingers travel almost a half-marathon everyday. Or, put another way, 12 times further than I’ve ever ran…

So, I decided to channel my inner MythBusters and attempt to find out if this claim was really true.

Does anyone actually care about this statistic? No, probably not. But this is the level of boredom we’re at in quarantine.

## Algorithm

The total typing distance was calculated with a few assumptions:

1. Typists use touch-typing and set their hands in the way shown in the image above.
2. All measurements involved are based off the Apple Magic Keyboard and I’m estimating the vertical change on a key press to be 1mm.
3. After typing a character, the user will return their finger to the home row unless the character repeats.

The algorithm would simply measure how far a finger moves from its original location (in centimeters) on the home row. Then, the final typing distance would simply be calculated as the sum of these values.

Taking the image above as an example, if the letter `f` was typed, no straight line distance would be travelled.

In contrast, if they typed `t`, we would add the straight line distance from the center of the `f` key to the center of the t key. Additionally, we’d also add the straight line distance returning from `t` back to `f`.

Although it seemed reasonable at first, I realized we would have to deal with a few more edge cases.

Typically, a user typing `cool` wouldn’t bring their finger back to the home row after typing the first `o`. It’s likely they’d keep it there and just press the key twice. So instead of counting a finger’s distance to the key and then the distance back to its origination location, the distance back should only be included if the new character differs from the previous one.

If you’re using `Shift`, you’ll encounter a similar problem. You’d naturally press the `Shift` key at the start of the word `COOL` and release your finger only at the end when there are no more uppercase characters to type. So, in order to be accurate, I should only count the distance to and from `Shift` when the input changes from upper to lower case.

In this `characters` dictionary, we defining a mapping between characters and the straight line distance to their origin keys on the home row (measured in cm on the Apple Magic Keyboard).

## Code

Here’s the finalized code:

This article argues that we all type much less than we think, while providing a nice upper limit for testing.

On average, English words contain five characters per word hence the 250 strokes / min assumption.

So, it seems reasonable to assume that, in practice, an individual might type 45K lines a day or 120K (15K x 8 hours) lines a day assuming they don’t take any breaks or have any interruptions.

Let me know if you’re willing to let me install a key logger on your computer so I can get a more accurate number 😉 .

## Results

We’d have to write all of “A Tale of Two Cities” in a single day for us to hit a total travel distance of 12 miles.

Instead, looking at an average to above average typist, we can see that their fingers would travel no more than 1.5 miles in a day.

If you liked this post, feel free to follow me on Twitter, or check out any of my other posts.