Coding and Keyboards | Hendrik Erz

Abstract: If you’ve ever written some code – Python, R, or Stata, it really doesn’t matter – and used several different types of keyboard to do that, you may have noticed that writing code is easier on some keyboards and harder on others. In this article I want to dive into the cultural and technological contexts in which programming languages are being developed and how they shape both the structure and the looks of code.

I haven’t written anything for quite some while, because I was (and am still) busy with my research; but I just stumbled upon this Reddit post, and thought that this is a very good chance to write about an interesting discovery I made a short while ago regarding coding and keyboards. The post mentions that it is much simpler of writing code with an English keyboard than it is with a Spanish keyboard. Here, I want to explain why, and what this shows us about the cultural and technological context in which computer languages are being developed and implemented. Because it turns out that the culture of software has just as much an influence on the software as the keyboard layout used by the programmers.

Why is Writing Code with a non-English keyboard difficult?

For most of my life, I only ever used German keyboards, because … well, that’s where I’m from. So I know the German keyboard layout by heart. Also, I started doing a lot of coding very early on, and one thing that always bothered me is that curly brackets, which are kind of necessary for most coding work are really hard to do on a German keyboard. On either Windows or Mac you have to hold down the alt key and press either 8 or 9 to insert { or } respectively. This is anything but ergonomic, and given the amount of curly brackets one has to use to code, this can be cumbersome.

The same holds true for most European keyboards. Be they Spanish, be they Italian, Danish, or Swedish — all of them face the same difficulty: Writing some of the most common characters in programming languages is very difficult. But why is that so?

Common Types of Keyboards: ISO and ANSI

While dealing with implementing keyboard shortcuts for Zettlr, I used a more theoretical approach to keyboards and did research on what different layouts are out there. Specifically, there are two broad and generic layout categories1, and each language has its own special keys. Each keyboard is a combination of the key arrangement and what keys are present. For example, in Germany, the traditional keyboard layout is DE-ISO, which means an ISO-style keyboard with German keys. In fact, most European keyboards fall into the ISO-category. The simplest indicator of an ISO-keyboard layout is that the return key spans two rows of keys.

The other large group of keyboards falls into the ANSI-category, which is indicated by a single-row return key. Here, the US keyboard layout is paradigmatic, and US-ANSI is one of the most common, if not the most common, keyboard layout in use around the world. There are some other differences, however. For example, an ISO-keyboard has a short left shift key and a </>-key next to it, whereas ANSI-keyboards have a long left shift key and are lacking this particular key.

And this key led me to a realization. A bit of context: during the pandemic, I discovered building and soldering my own keyboards. Most custom mechanical keyboard parts come in US-ANSI layout, however, so I decided to just go with it and try out the US-ANSI layout for once. And this made me realize what the Reddit post talks about: Coding on a US-ANSI keyboard is much easier and faster than on my regular DE-ISO keyboard.

Programming is Easier on an ANSI-Keyboard, Except HTML

The main reason is that square brackets ([ and ]) can be written without any additional keys, and the curly brackets only require you to press shift, which is much more ergonomic than pressing the alt or option key for that. Most of the time you have one of your digits very close to the shift key anyway, so it is simple to just press this key. Moving a digit to the bottom row of your keyboard, however, where the option or alt key sits requires more movement of your hand. This makes typing brackets – one of the most common characters in many coding languages – much faster on an ANSI-keyboard.

However, at the same time I also discovered that writing HTML code specifically was much slower than on the ISO-keyboards. The reason for this is the existence of the dedicated </> key next to the left shift. Writing HTML code works by quickly pressing that key, then typing the tag name, and then pressing shift + < to insert the closing angle. On an ANSI-keyboard, however, you have two keys (the comma and period) that share the angle responsibility, and you have to press shift for both.

This then suddenly explained why so much HTML code is written IN UPPERCASE LETTERS: On a US-ANSI keyboard, you can circumvent the pain of having to use angle brackets by simply enabling caps lock and then typing everything without pressing shift at all.

The Cultural and Technological Context Determines What Programming Languages Look Like

But why would HTML use such an inconvenient character for code, while all the other languages use easy to reach characters (for US keyboard users)? Well, while most programming languages have been invented either by US-Americans, in the USA, or at least with a strong US bias, HTML has been invented elsewhere. At CERN, to be precise. Tim Berners-Lee invented HTML while he was in the Swiss laboratory, and thus was most likely using an ISO-type keyboard, which features this handy button next to the shift key.

And this is a fascinating discovery for me as a sociologist. It goes to show how much culture and the physical environment permeates into things as mundane as which characters are used by people for developing new programming languages. People constantly search for simple ways to facilitate something, and when you need a character that is not in the alphabet, Europeans will most likely choose < and >, while Americans may choose { and }.

Indeed, some templating languages that build on top of HTML use curly brackets instead of angle brackets. For example, Twig utilizes ({{% and %}}) to delimit statements, because it has been developed in the United States. Other things are less explained by the technical part of the social context (a.k.a., the layout of your keyboard), and are solely based on cultural context. For example, a common character to denote variables (in PHP, for example), is the Dollar-sign. Typing a Dollar is easy on all types of keyboards, but of course, it is guided by the US-American context. (Imagine the fun if a programming language had been invented in Germany and would use € as a variable indicator.)

Keyboard Layouts Explain Why VIM uses H, J, K, and L for Navigation

Apart from coding, there are other instances where the software has baked the keyboard layout used by its inventor built in. For example, in the vim text editor, you can navigate the cursor not just with the arrow keys, but with the h, j, k, and l keys. Why is that so? Some have argued that typing in the center row is more ergonomic, but that is not the reason. The real reason is that the computer used by the inventor of vim did not have dedicated arrow keys. Instead, the arrow keys were printed onto the h, j, k, and l keys, and for that single guy it therefore made absolute sense to use these specific keys. The 8-Bit guy has a fascinating video on the history of arrow keys and how the physical layout of the vim inventor’s keyboard made sure that everyone else now has to live with this decision.

So the next time you look at some code, you can already say something about the programming language and the programmer themselves. For example: if some website’s source code is written entirely in UPPERCASE, e.g., (<DIV> instead of <div>), you can reasonably well assume that the person who wrote it was using a US-ANSI keyboard. If it’s in lowercase, then it is either generated (which is true for most websites today), or written by someone using an ISO-style keyboard.

1 Some may now shout “But what about Dvorak?!” — you are right, there are other layouts, but I’m only focusing on what most people will encounter in everyday situations here.

Suggested Citation

Erz, Hendrik (2023). “Coding and Keyboards”., 11 Oct 2023,

Did you enjoy this article? Leave a tip on Ko-Fi!

← Return to the post list