We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Hardware

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What Is a Scancode?

By Alex Newth
Updated: May 17, 2024
References

Very few people recognize how many calculations, codes and processes are used just to get a character from a computer keyboard onto the screen. One part of this function is the scancode, or a hexadecimal code that is the equivalent of the key pressed on the keyboard. There is a scancode for every key on the keyboard, and there is another separate scancode for when the key is released. Keyboards for different character structures, such as Asian languages, will have a different number of scancodes because the number of keys differs. When the button is pushed, the code is placed into a buffer area so the computer can process and then add the character or recognize the key.

The entire keyboard process can be separated into several different steps. When the key is pushed, the scancode enters the keyboard buffer. While in the buffer, an interrupt is utilized to tell the computer that something has been pushed on the keyboard. After understanding that a key was pushed, the computer looks at the buffer, checks the hexadecimal code, then adds the character or its attribute onto the screen.

Both text and control characters have scancodes. Text keys are the more commonly used ones — containing letters, numbers and symbols — but control characters are used often as well. Control characters are the ones that do not make any symbol but affect the document or character processing, such as the "shift" keys or "enter" key.

Every key on the keyboard actually has two different scancodes, one for pressing and one for releasing. When a key is pushed, it gives one scancode, and the second code adds 128 to the hex value. This might seem useless, because it seems rare for someone to hold a key for several seconds, but this is done often with some control characters such as the "shift" keys or "delete" key.

The hexadecimal value for each key differs based on the keyboard. Each company has its own keyboard, and although the configuration might be similar to or even the same as other ones, the scancodes might be different. This usually is to allow the manufacturer to make keyboards with different key configurations or to add new functions to the keyboard, such as a "print" key.

Another factor in determining the hexadecimal value of each key is the language for which it is made. For example, Japanese and English keyboards have a different number of keys because the number of characters used differs. Different English-speaking countries, such as the United States and England, have different keyboards as well; most English keyboards have 102 keys, and most U.S. keyboards have 101.

WiseGeek is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Link to Sources
Discussion Comments
Share
https://www.wisegeek.net/what-is-a-scancode.htm
WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.

WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.