How Many Keyboard Shortcuts Are There

By Xah Lee. Date: . Last updated: .

Have you ever pressed key chord like Ctrl+Alt+Delete ⌦ ? What about key sequence such as F10 e c? (in Microsoft Windows, that activates menu, edit, and copy.)

How many chord combinations are there? and how many key sequences are there? Let's find out.

Let's consider the 4 modifiers: Alt Ctrl Shift ❖ Window . (lets forget about the right side modifiers for now). If we can use only 1 modifier, we have

We have a total of 4 possibilities.

Now, lets consider in combination with letter keys. For ease of calculation, let's say there are only 20 letter keys to chose from to be used with modifier. e.g.

So the total is 4 * 20 = 80

If we can hold 2 modifiers, we have

We have 6 possibilities

4 things, select 2 out of it, order doesn't matter, the possible choices are 6.

Now, since there are 20 letters to combine with, we have 120 possible choices, because 6 * 20 = 120.

We can write this by a formula: xah_binomial(4,2) returns 6.

The formula xah_binomial(n,k) is the possibilities of taking k things out of n. ( The formula is usually called Binomial coefficient, and is Binomial[n,k] := n! / (k! (n - k)! ))

Now, with formula, we have:

So 4 modifiers, holding any of 1 to 4 of them at the same time, is 15 possibilities. ( 4 + 6 + 4 + 1 === 15)

Multiply by 20 letter key choices ( 15 * 20 === 300 ), result is 300 possibilities.

Here is the code to compute it:

const xah_factorial_values = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800, 87178291200, 1307674368000, 20922789888000];

const xah_factorial = ((n) => ( ( n < xah_factorial_values.length ) ? (xah_factorial_values[n])
: (xah_factorial_values[n] = xah_factorial(n-1) * n) ) );

// xah_binomial(n,k) returns the Binomial coefficient. (or, the possibilities of n things take k) Version 2020-07-17
const xah_binomial = ((n,k) => xah_factorial(n) / ( xah_factorial(k) * xah_factorial(n - k) ) );

With code, it looks simpler. Look at this:

// 4 modifiers, holding 1
console.log ( xah_binomial(4,1) === 4 );

// 4 modifiers, holding 2
console.log ( xah_binomial(4,2) === 6 );

// 4 modifiers, holding 3
console.log ( xah_binomial(4,3) === 4 );

// 4 modifiers, holding 4
console.log ( xah_binomial(4,4) === 1 );

console.log ( 4 + 6 + 4 + 1 === 15);
// sum is 15

// multiply by 20 letter key choices
console.log ( 15 * 20 === 300 );
// result is 300

Now, we consider both sides of Alt Ctrl Shift ❖ Window . There are a total of 8 modifiers.

8 modifiers, holding 1 to 4 of them at the same time, then press 1 of 20 letter key choices, give us 3240 possibilities.

console.log ( xah_binomial(8,1) ); // 8
console.log ( xah_binomial(8,2) ); // 28
console.log ( xah_binomial(8,3) ); // 56
console.log ( xah_binomial(8,4) ); // 70

console.log ( 8 + 28 + 56 + 70); // 162
// sum is 162

console.log ( 162 * 20 ); // 3240
// possibilities of chord with holding max of 4 out of 8, with 20 letter choices

We stop at holding 4 modifier at the same time, because holding more than 4 modifiers is not practical.

How Many Key Sequence Combinations Are There?

Now we consider key sequences such as F10 e c.

Let's call the first key (such as F10) the leader key. Let's suppose there are 20 letter keys to chose from, for easy calculation.

For total of 3 key presses, counting the leader key, and suppose 20 letter key choices, we have 400 possibilities.

// 3 keys key sequence possibilities
console.log ( 1 * 20 * 20 ); // 400

If we allow total of 4 key strokes, we have 8000 possibilities.

// 4 keys key sequence possibilities
console.log ( 1 * 20 * 20 * 20 ); // 8000

That's a lot more than chord keys.

Now we consider leader key sequence of 3 keys, but 2 different leader keys, we have

// 3 keys key sequence, 20 letter choices, 2 leader keys
console.log ( 2 * 20 * 20 ); // 800
// 800 possibilities

Here is a list of n leader keys possibilities:

So, a total of 3 key presses in order, with 8 possible choice of starting keys, and 20 letter choice of subsequence keys, give us 3200 possibilities.

Conclusion

Comparing the ease of pressing keys and possible combinations:

Note: the holding modifer keys are bad due to the position of the modifiers, typically at corner of keyboard, and due to a particular order of press/release required. For example, to press Ctrl+c, you need to it in this order:

  1. press Ctrl
  2. press c
  3. release c
  4. release Ctrl

Must be in that order precisely.

If the modifier key are designed as true chord keyboard keys, such as on piano or steno machine, then chord is faster to press than key sequences (because you press all of the keys at once, instead of one by one), and also more combinations (because now you can press practically 8 keys at once (as in piano playing).)

See also:

Keybinding and Input-System

Xah Keyboard Guide