ArticleslgStudy

computer science

Alt code

Alt code is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Alt code rather than just read about it. In short: On personal computers with numeric keypads that use Microsoft operating systems, such as Windows, many characters that do not have a dedicated key combination on the keyboard may nevertheless be entered using the Alt code (the Alt numpad input method). This is done by pressing and holding the Alt key, then typing a number on the keyboard's numeric keypad that identifies the character and then releasing Alt.

Key takeaways

  • Alt code belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Alt code to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Alt code from memory before moving on to harder problems.

Reference excerpt

On personal computers with numeric keypads that use Microsoft operating systems, such as Windows, many characters that do not have a dedicated key combination on the keyboard may nevertheless be entered using the Alt code (the Alt numpad input method). This is done by pressing and holding the Alt key, then typing a number on the keyboard's numeric keypad that identifies the character and then releasing Alt.

MS-DOS On IBM PC compatible personal computers from the 1980s, the BIOS allowed the user to hold down the Alt key and type a decimal number on the keypad. It would place the corresponding code into the keyboard buffer so that it would look (almost) as if the code had been entered by a single keystroke. Applications reading keystrokes from the BIOS would behave according to what action they associate with that code. Some would interpret the code as a command, but often it would be interpreted as an 8-bit character from the current code page that was inserted into the text the user was typing. On the original IBM PC the code page was CP437. Some Eastern European, Arabic and Asian computers used other hardware code pages, and MS-DOS was able to switch between them at runtime with commands like KEYB, CHCP or MODE. This causes the Alt combinations to produce different characters (as well as changing the display of any previously entered text in the same manner). A common choice in locales using variants of the Latin alphabet was CP850, which provided more Latin character variants. (There were, however, many more code pages; for a more complete list, see code page). PC keyboards designed for non-English use included other methods of inserting these characters, such as national keyboard layouts, the AltGr key or dead keys, but the Alt key was the only method of inserting some characters, and the only method that was the same on all machines, so it remained very popular. This input method is emulated by many pieces of software (such as later versions of MS-DOS and Windows) that do not use the BIOS keyboard decoding. In the ASCII standard, the numbers 0-31 and 127 are assigned to control characters, for instance, code point 7 is typed by Ctrl+G. While some (most?) applications would insert a bullet character • (code point 7 on code page 437), some would treat this identical to Ctrl+G which often was a command for the program.

Windows The Alt codes had become so well known and memorized by users that Microsoft decided to preserve them in Microsoft Windows, even though the OS features a newer and different set of code pages:

The familiar Alt+### combination retains the old MS-DOS behavior, i.e., generates characters from the legacy code pages now called "OEM code pages". For instance Alt+163 produces ⟨ú⟩ from code point 163 in CP437 or CP850. The "OEM code page" selection served little or no other purpose other than to control what Alt codes produced, it did not change the display of any existing characters (unlike character-mode MSDOS). It was impossible to type characters that were not in the Windows code page, such as box-drawing symbols. The new Alt+0### combination (which prefixes a zero to each Alt code) produces characters using the Windows code page associated with the current input locale (keyboard layout). For instance Alt+0163 results in ⟨£⟩ (when CP1252 is active) because it occupies position 163 in CP1252.

Unicode Later versions of Windows and applications such as Microsoft Word added support for Unicode. This had the benefit that all the "old" Alt combinations, for instance for line-drawing characters, worked again (instead of being limited to characters in the current code page). In the IBM PC BIOS, typing an Alt code greater than 255 produced the same as that number modulo 256. Some applications retained this behavior, while others (in particular applications using the Windows RichEdit control, such as WordPad and PSPad) made numbers from 256 to 65,535 produce the corresponding Unicode code point. For instance, Alt+9731 in WordPad produces the U+2603 ☃ SNOWMAN (9731decimal = 2603hexadecimal). Since CP1252 maps code points 32–126 and 160–255 identically to Unicode, all Unicode code points except control characters can be entered as their decimal equivalent (a zero prefix is required for less than 256).

Hex Alt codes Because most Unicode documentation and character tables show code points in hexadecimal rather than decimal, Windows added a mechanism to input Alt codes in hexadecimal form. To enable it, a user must set or create a string (REG_SZ) value called EnableHexNumpad in the registry key HKEY_CURRENT_USER\Control Panel\Input Method, assign the value data 1, and then reboot or log out/in. Holding Alt and pressing + on the numeric keypad starts a hexadecimal Unicode code point. The digits are entered using the numeric keypad, while the letters A–F are typed on the main keyboard. For example, Alt++11B produces U+011B ě LATIN SMALL LETTER E WITH CARON. Only the last four digits are used, limiting input to Unicode BMP. Windows also supports an alternative hexadecimal input mode (less commonly documented) where Alt+. on the numeric keypad allows an 8-bit character to be typed as hex.

Other operating systems The Alt key method does not work on ChromeOS, macOS, Linux or other operating systems and there is no evidence of interest in replicating it. Unicode input via hexadecimal code points is usually supported.

Limitations If Num lock is disabled, attempting an Alt code may cause unexpected results in some applications, due to the controls used on the same key. For example, Alt+4 can be taken as Alt+←, causing a web browser to go back one page.

List of codes

See also Combining character – Non-spacing character that modifies another character Compose key – Computer key to initiate glyph merger Numeric character reference – Common markup construct used in SGML, XML, and HTML List of Unicode characters

Notes

References

Worked examples

Example 1 — a first encounter with Alt code

Start with the simplest possible case. Write down what Alt code claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Alt code before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Alt code ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Alt code

In research
Alt code appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Alt code in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Alt code is common in secondary-school and first-year university syllabi. It links to neighbouring topics Character encoding, Computer keyboards, Input methods, so understanding it makes those chapters shorter.
In everyday life
Look for Alt code outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Alt code” →

How to study Alt code in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Alt code means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Alt code out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Alt code in simple terms?

On personal computers with numeric keypads that use Microsoft operating systems, such as Windows, many characters that do not have a dedicated key combination on the keyboard may nevertheless be entered using the Alt code (the Alt numpad input method). This is done by pressing and holding the Alt k…

Why does Alt code matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Alt code?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Alt code.

Tags

  • Character encoding
  • Computer keyboards
  • Input methods

Keep exploring