How to Change Your Keyboard Layout on Raspberry Pi OS?
If, like me, you don’t use a QWERTY keyboard, the first thing you are probably looking for on your Raspberry Pi is how to change the default layout. In this article, I will explain how to do this on Raspberry Pi OS.
On Raspberry Pi OS, the default keyboard layout is QWERTY. If not set during the installation, it can either be changed in the Raspberry Pi Configuration tool from a Desktop environment, or via raspi-config in a terminal or Lite version.
In short, there are several ways, and you only need to do it once, so feel free to use the table of contents below to pick the one that fits your current situation.
If you need help getting started on Raspberry Pi, I have an entire course to guide you through your first steps. I’ll help you use the perfect hardware, plug everything in and install your first system. You’ll also do your first projects with me, just to make sure you are ready for the next level. Get all the information on this page if you are interested.
Change the keyboard during the system installation
Over the past few years, the Raspberry Pi team has made progress in making it easier to customize your system before you even open your first session on it. These are the best ways to change the keyboard layout before you type anything on the Raspberry Pi:
- Change it directly in Raspberry Pi Imager using the advanced options.
- Or change it using the Welcome Wizard on the first boot.
Let’s discuss how to do this if you’re just installing your system and haven’t started it yet.
Use the options in Raspberry Pi Imager
I highly recommend using Raspberry Pi Imager to flash your system to the SD card, especially if you are not using a keyboard with the default layout on your Raspberry Pi (basically anything that is not QWERTY).
When you flash your system, Raspberry Pi Imager gives you the option to apply “OS customization settings”, where you can choose the keyboard layout, among other things:
Check the “Set local settings” box, select the keyboard layout from the drop-down list, and it will be applied the first time you boot. There’s nothing else to worry about.
If you are lost in all these new words and abbreviations, request my free Raspberry Pi glossary here (PDF format)!
Download now
Note: I have a full guide on Raspberry Pi Imager if you need more step-by-step guidance with this tool.
Change the keyboard layout in the first boot wizard
If you’ve already flashed your SD card and skipped the OS customization settings (or used another tool), don’t worry, there’s another easy way to try on the first boot.
When you boot Raspberry Pi OS for the first time without a custom configuration on your SD card, it will no longer start your session directly, as it did in older versions. It will now ask you a few questions, including your localization (country, language and keyboard options), but also other things like network settings, username and password, etc.
That’s where you can still select a different keyboard layout, which should apply before you have anything to type with your keyboard (more details here).
There are fewer options here than on the system, but it should be enough to set up a basic configuration, and you can always read the next sections if you need to fine-tune things.
Change the keyboard layout on the Raspberry Pi OS Desktop
On Raspberry Pi OS with Desktop, the keyboard layout can be changed by going into Preferences > Raspberry Pi Configuration and then finding the keyboard settings under the localisation tab.
You have a graphic tool to do this easily, so this will be a short tutorial :).
- Open the main menu.
- Go to Preferences > Raspberry Pi Configuration.
- Then go to the “Localisation” tab.
- And finally, click on “Set Keyboard”.
- From here you can select:
- The keyboard model: Most of the time you can keep the default one.
- The layout: It’s the keyboard country you are using.
- The variant: If your keyboard uses a specific layout for this country, select it here (DVORAK for example).
- Click “OK” to apply the changes.
That’s it, your Raspberry Pi is now using your favorite keyboard layout.
Change the keyboard layout on Raspberry Pi OS Lite
On Raspberry Pi OS Lite, the easiest way to change the keyboard layout is to use raspi-config. The keyboard settings are in the “Localisation Options” menu.
There is no graphic tool, but raspi-config will help you to do this.
- Start raspi-config:
sudo raspi-config
If you’re having trouble entering this command, here’s what the default keyboard layout looks like:
Click on the keys on your keyboard corresponding to this layout. - Go to “Localisation Options”.
- Then select “Keyboard”.
- The first step is to pick the keyboard model you are using.
Most of the time, you can keep the default one (Generic 105-key PC). - Now, you need to select the keyboard layout.
By default, the list only includes variants of your current setup, but you can click on “Other” to get access to more options and countries. - And finally, choose the specific layout for this country.
If you have any doubts, select the first one on the list and give it a try. - The last two or three questions are for the keyboard configuration.
You can select the behavior for the “Alt Gr” and compose keys.
I always keep the default configuration personally.
After a few seconds, your keyboard is now correctly configured. Raspberry Pi OS Lite will be much easier to use with the key in the right position :).
You can do the same thing via SSH by the way, with the advantage that the keyboard layout via SSH will be the one you use on your computer.
Also: Want to install Windows 11 on your Pi? Here's how
If you are lost in all these new words and abbreviations, request my free Raspberry Pi glossary here (PDF format)!
Download now
Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
FAQ
How to change the keyboard layout on a Debian-based distribution?
On any Debian-based system, the keyboard layout is stored in the /etc/default/keyboard file. It’s possible to edit this file to change the current keyboard layout, even when raspi-config is not available.
More details on the Debian wiki.
How to change the keyboard layout on RetroPie?
Retropie is based on Raspberry Pi OS, raspi-config is available in the command line or via the settings menu. Open it and go to Localisation options > Keyboard to select the layout you want to use.
Check my complete guide about Retropie for beginners here.
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now
Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.
Conclusion
Congrats! You now know how to change the default keyboard configuration on your Raspberry Pi.
It’s often the first step after the installation, and even if this tutorial is relatively short, it is crucial to take a good start on Raspberry Pi.
If you are just starting, you can also check my list of beginner tips on Raspberry Pi.
Whenever you’re ready, here are other ways I can help you:
The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.
You can also find all my recommendations for tools and hardware on this page.
I have RAK2245 PIHat OS which from all appearnces Raspbian 10 Buster. A couple of the keys don’t print the expected characters, specifically the backslash character ‘\’ which prints the hash character ‘#’. This is a major showstopper since postgresql command line utilizes the ‘\’ extensively. And it doesn’t print the pipe ‘|’ but a tilde ‘`’ character. This behavior has been replicated with three diffe and wirerent keyboards, Logitech wireless and wre and a wired Chromata gamer keyboard.
Logging in via SSH the keystroked print correctly.
Please advise.
This was, by far, the most complete treatment of keyboard maps for the Raspberry Pi that I have found to date. Thank you.
Someone, somewhere, must have figured out how to swap the command and control keys on a Raspberry Pi so that it matches an Apple keyboard layout. Using raspi-config, I have tried simply selecting every one of the “Apple” keyboard options, but none of them do what I am looking for. Simply, I would like to remap the cntrl key from it’s default location so that it is on the keys immediately adjacent to the space bar (the left of which currently calls the RPi menu), moving that functionality to the former location of the cntrl keys. To further complicate my needs, I NEED the international keyboard with dead keys functionality as well. (I switch between english and spanish multiple times a day).
Please don’t bash me as a Mac user. I came to the mac from NextStep/OpenStep and OpenBSD. I am very happy working in Pi-world (I have deployed 6 of them in my own home for various purposes). But switching back and forth from the 2 primary OSs that I use is a pain (I have the same pain when I have to work on a windows box).
Further, swapping these keys is user configurable option even on ChromeOS. It has simply got to be possible but I don’t know what options I would include in the /etc/default/keyboard file.
Thanks is advance for any tips.
Has anyone figured out the key(s) proper keyboard for the ‘\’ “forward slash” key to function properly?
The character you typed is actually a backslash. Regardless, I got my keyboard configured correctly using the instructions in the article (using ‘sudo raspi-config’, which was already installed on Raspberry Pi OS Lite). My OS install was configured to use a bunch of UK stuff, not US, so I had to change as many default settings from UK to US as I could find. I also made sure I used a keyboard layout that didn’t include “(intl)”, so I used something like the Generic 101-key or Generic 104-key keyboards. I didn’t bother counting the keys on my keyboard, but whatever one I tried first worked for all of the special characters I needed. But, of course, your settings will depend on your keyboard and country.