How to Fix Typing Wrong Keyboard Characters in Raspberry Pi

The first time I used a Raspberry Pi years ago, I got frustrated that I could not connect to the WiFi Network. So I tested on the text editor if I am typing the correct password. As it turns out, pressing the backslash (\) on the keyboard will type the hashtag symbol (#), and if I press Shift + 2 will type double-quotes (") instead of At sign (@).

The reason for the incorrect characters being typed is by default the Raspberry Pi is set to use a UK-based keyboard layout. To correct this, we need to reconfigure the keyboard layout to the ones we are using.

In my case, I am using a US-based keyboard layout. In the tutorial below that is what I am going to use. You can select the keyboard layout that you are using.

There are several ways to update the Keyboard Layout in a Raspberry Pi, you may choose which one you prefer on the list below.


Set Keyboard Layout via Raspberry Pi Configuration (Desktop)

If you are using Raspberry Pi OS Desktop, then the easiest way to fix the Keyboard Layout is by adjusting the settings in Raspberry Pi Configuration.

Click on the Applications Menu (Raspberry Pi icon in the upper-left corner).

Hover over Preferences, then click Raspberry Pi Configuration.

The Raspberry Pi Configuration window will open.

Click on the Localisation tab, then click on Set Keyboard….

A new window will open. Click on the dropdown beside Layout.

This will open a long list of location-based keyboard layouts. Choose the keyboard layout of your country.

In my case, I will be selecting English (US).

Once you have selected your Keyboard Layout, the Variant will automatically follow.

Click OK.

This will then show a panel saying “Setting keyboard – please wait…”.

After the panel disappears, click on OK.

You have successfully modified your Keyboard Layout. Open Text Editor and check if your keyboard is typing the correct characters.


Set Keyboard Layout via raspi-config (Terminal)

If you are using Raspberry Pi OS Lite (version of Raspberry Pi without a Desktop) or simply want to use the Terminal to correct your Keyboard Layout, then follow the instructions below.

Open Terminal.

Type the command sudo raspi-config, then press Enter.

Using the arrow keys of your keyboard go to 5 Localisation Options. Then press Enter on your keyboard.

Select L3 Keyboard, then press Enter.

Select Generic 105-key PC (intl.) then press Enter.

Select Other, then press Enter.

Select your country’s keyboard layout. Then press Enter.

In my case, I will be selecting English (US).

In the next selection menu, select English (US) again. Then press Enter.

Select The default for the keyboard layout. Then press Enter.

Select the No compose key. Then press Enter.

Select Finish, then press Enter.

Then you will be back in the Terminal again.

Here you can test if the keyboard is typing the correct characters.


Set Keyboard Layout via First Run Setup of Raspberry Pi Desktop

If you are using a fresh install of the Raspberry Pi OS on an SD Card, then running it for the first time will launch a series of setup questions at the start.

Here you can set your target Keyboard Layout.

During the Set Country section, check Use US Keyboard.

Once you click Next, this will set the keyboard layout to US, which will be useful in other sections of the setup of your Raspberry Pi.

Set Keyboard Layout via Raspberry Pi Imager

We can also use the Raspberry Pi Imager to set the correct Keyboard Layout when we write the Raspberry Pi OS to our SD Card.

To do this, once you have selected the Raspberry Pi OS click on the setup icon that appears on the lower right.

The Advanced options window will appear.

Check Set locale settings.

Change the Keyboard layout to your country’s keyboard layout.

In my case, it is us.

Then click SAVE.

Finish the Raspberry Pi Imager process until you have written your Raspberry Pi OS to your SD Card.

Once you run the fresh install of your Raspberry Pi, it will automatically use the Keyboard Layout that you selected.


If ever you did the process above and are still getting typing the wrong characters, try adjusting the keyboard layout to other settings. If not, you might want to check if there is something wrong with your keyboard.

I hope this helps correct the error of the keyboard not typing the correct characters in Raspberry Pi. Let me know what you think in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.