# How many keyboard key combinations are possible in Ubuntu?

You can press modifier keys (Ctrl, Alt, Shift and Super) together with regular keys like A or S, etc. to produce a unique key combination.

Does anyone know the total number of possible combinations?

Bear in mind Left Shift+A and Right Shift+A could be two different combinations but I'm not sure. I tried googling this question but didn't find an answer.

NOTE: My keyboard has 12 function keys plus a Fn function key modifier key for things like brightness control, media playback control, etc. Some of these key combinations might be tied into ACPI or laptop hardware and don't count. There is also a separate directional control region (Home, PgUp, arrow keys, etc. plus a separate numeric keypad.

• OK I had a think about this and would like to know the answer myself, so I am going to attempt an answer for you. However, I am no mathematician, so if a make a mistake and mess it up, just tell me straight ;) Feb 18, 2017 at 18:08

In the image below I have limited the number of keys by blacking out the ones that, in my opinion, would not really be used for this (enter,arrows, hardware etc) and coloured the keys to be modifiers in gray. This will give us a nice starting point.

This gives us, 6 modifier (mod) keys and 63 normal keys (key), so to get the amount of two key combinations we can do `key*mod` and get 378, call this A.

To get the number of three key combinations we have 6 mod keys and each can be paired with another, so each key can have 5 combos. If we do `6*5` we get 30 (com) and we can multiply this by key to get the number of three key combinations `com*key` is 1890 and call this B.

Finally we can add A to B and get the number of mappable shortcuts for Unity, within the given criteria.

``````A+B = 2268
``````

To summarize:

``````mod*key + com*key = answer
``````

You should be able to use this on any keyboard by assigning the numbers to the variables (key, mod, com) by counting them and then using the final equation to work out the number of possible shortcuts.

I am no mathematician but I think I did this right, please anyone feel free to tell me if I am not in the comments but I had to answer this, it was driving me nuts.

Apologies for raising a necro post but I had to post. I'm currently working on a hotkey macro script and this came into my calculations :)

Combinations equals (number of modifiers) (to the power of 2)

So (2^6 = 64)

Here's a list of possible combinations of 6 modifiers pressed,

[0] 1 key with no modifiers pressed.

[1] 6 Combinations of 1 key with just one modifier pressed

[2] 15 Combinations of 1 key with 2 modifiers pressed

[3] 20 Combinations of 1 key with 3 modifiers pressed

[4] 15 Combinations of 1 key with 4 modifiers pressed

[5] 6 Combinations of 1 key with 5 modifiers pressed

[6] 1 Combination of 1 key with all 6 modifiers pressed

Therefore each key has a potential of 63 unique combinations with 6 modifiers, 64 if you include it on it's own.

Different operating systems, software, hardware, keyboards, etc. may have limits.