> For the complete documentation index, see [llms.txt](https://jonny-wamsley.gitbook.io/the-ultimate-guide-to-keyboard-layers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jonny-wamsley.gitbook.io/the-ultimate-guide-to-keyboard-layers/ch-1-keyboard-layers-101/1.1-keyboard-fundamentals.md).

# 1.1 Keyboard Fundamentals

A keyboard is an arrangement of keys that when pressed, sends a `key code` to a keyboard driver. `Key codes` are all the keys like Alphanumeric(a, b, 1, 2), modifier(ctrl, alt/option), arrow keys and many more. All the keys on a keyboard form a `keyboard layout` that represents a collection of keys and their position. There are some common layouts that even have names such as qwerty, colemak, and dvorak that are shown below.

![qwerty layout](/files/cWUnSgBKGaaEzT4wwGOU)

![dvorak layout](/files/9gja0SdwrkG5Rz4poJG5)

![colmak layout](/files/fn3FTGkCdjgOfKW7c59H)

The purpose of a keyboard is to be an input device to communicate information to your computer. If a key outputs a single code, then there would be a one-to-one relationship, where each key gets a single keycode output. This is quite impractical and would require lots of rows and keys like in the picture below.

![](/files/RS2koVIIWlClHdJeJo0s)

A key can instead have a one-to-many relationship with the help of `layer activators.` Layer activators are the keycodes like the shift and capslock keys. When the shift activators is activated keys switch output from lowercase letters to upper case letters. This creates a one-to-two relationship, where one key can have 2 possible output states, lower and upper. When talking about just the lowercase keys or uppercase keys on the layout, it is called a `layer` followed by a description word. So the starting layout is made of 2 layers, the default layer or base layer containing lower case keys and the upper, shift or caps layer containing the uppercase letters.

{% hint style="success" %}
A layer is the collection of the keycodes with their position and typically have a theme
{% endhint %}

There are many more keyboard layers, such as the function layer(Fn), number layer and navigation layer and many more that will be discussed later. Together, all these keyboard layers can be grouped together to create a \`keymap\`. A Keymap is useful if you move between keyboards or want to share all the layers at once.

```markup
Keymap: 32 Layers                   Layer: action code matrix
-----------------                   ---------------------
stack of layers                     array_of_action_code[row][column]
       ____________ precedence               _______________________
      /           / | high                  / ESC / F1  / F2  / F3   ....
  31 /___________// |                      /-----/-----/-----/-----
  30 /___________// |                     / TAB /  Q  /  W  /  E   ....
  29 /___________/  |                    /-----/-----/-----/-----
   :   _:_:_:_:_:__ |               :   /LCtrl/  A  /  S  /  D   ....
   :  / : : : : : / |               :  /  :     :     :     :
   2 /___________// |               2 `--------------------------
   1 /___________// |               1 `--------------------------
   0 /___________/  V low           0 `--------------------------
```

Picture of a keymap made from layers from [QMK](https://docs.qmk.fm/#/keymap) docs.<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jonny-wamsley.gitbook.io/the-ultimate-guide-to-keyboard-layers/ch-1-keyboard-layers-101/1.1-keyboard-fundamentals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
