MouseButtonTest
EN

Keyboard typing wrong characters or numbers? How to fix it

Updated October 2, 2026

You press @ and get ", Y types a Z, or letters suddenly come out as numbers. This almost never means the keyboard is broken – it's nearly always a setting you can switch back in seconds.

Step 1: find out what's really happening

Open the keyboard test and press the key that types wrong. Look at two values:

  • event.code – the physical key you pressed (for example KeyY).
  • event.key – the character your computer turned it into.

If event.code is the key you pressed but event.key is the wrong character, your keyboard is fine – the keyboard layout in your system is wrong. If event.code is a different key altogether, it's a hardware or remapping issue.

See the physical key and the character it produces.

Open the keyboard test →

Common symptoms and their fixes

Symbols in the wrong places (@ and ", # and £, \ and <)

Your system is using a different layout than your keyboard – typically US vs UK English. On Windows, press Win + Space to switch between installed layouts, and remove the ones you don't use under Settings → Time & language → Language & region → your language → Keyboard. On Mac, use the input menu in the menu bar or System Settings → Keyboard → Input Sources.

Y and Z swapped, or A and Q swapped

That's a German (QWERTZ) or French (AZERTY) layout active on an English keyboard, or the other way round. Switch the layout as above.

Letters type numbers (U I O J K L M → 4 5 6 1 2 3 0)

On many laptops without a separate number pad, Num Lock turns part of the letter keys into a hidden number pad. Press Num Lock – often Fn + Num Lk or Fn + F11 – to turn it off.

Layout keeps switching by itself

Windows switches layouts with Alt + Shift or Ctrl + Shift, which is easy to press by accident while typing or gaming. Remove the layouts you don't need, or change the shortcut under Advanced keyboard settings → Input language hot keys.

F1–F12 or media keys do the wrong thing

That's Fn lock or "action keys" mode. Many laptops toggle it with Fn + Esc – see our keyboard keys not working guide for more.

Every key types something completely different

If event.code itself is wrong, a remapping tool (PowerToys Keyboard Manager, AutoHotkey, gaming keyboard software) may be active. Turn those off and test again. If the test still shows the wrong physical key on another computer, the keyboard's controller is faulty.

Frequently asked questions

Why did my keyboard layout change by itself?

Usually an accidental Alt + Shift or Win + Space press switched to another installed layout. Removing layouts you don't use stops it for good.

How do I know which layout my keyboard is?

Look at the key next to left Shift and the shape of Enter: UK and most European keyboards have an extra key next to left Shift and a tall Enter key; US keyboards don't. The letters in the top-left row (QWERTY, QWERTZ, AZERTY) show the language family.

Can a virus change my keyboard layout?

It's extremely unlikely. Wrong characters are almost always a layout, Num Lock or remapping setting.