Alt code

On personal computers running the Microsoft Windows or DOS operating systems, additional characters to those available in the current keyboard layout can be typed using an Alt code: pressing and holding the Alt key while entering a character code with the keyboard's numeric keypad.[note 1]

Often this is the best or only method many computer users know for entering non-ASCII characters. Due to its popularity, the input method has been duplicated, including the use of obsolete code pages, to other operating systems. Many Wikipedia articles on various characters will include how to type that character using Alt codes for code page 437.

Contents

History and description

Originally in MS-DOS, the user could hold down the Alt key and type a decimal number on the keypad. The BIOS would turn this directly into the character code of the same value, which (if the program did not interpret as a command) would place that same code on the screen, thus displaying that character from the current code page. For systems using English, this is code page 437. For most other systems using the Latin alphabet, this is code page 850. For a complete list, see code page.

These numbers became so well known and memorized by computer users that Microsoft was forced to preserve them when it transitioned Windows to use the Windows-1252 and similar international sets. Holding Alt and typing a leading 0 (zero) and then a number would produce the character from the Windows code page. If there was no leading zero, an attempt was made to translate the code from CP437 to the matching glyph in the Windows code page.

For instance, the combination <kbd class="keyboard-key" style="border: 1px solid; border-color: #ddd #bbb #bbb #ddd; border-bottom-width: 2px; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; background-color: #f9f9f9; padding: 1px 3px; font-family: inherit; font-size: 0.85em; white-space: nowrap;">Alt</kbd>+0161 yields the character "¡" (Windows-1252), while the combination <kbd class="keyboard-key" style="border: 1px solid; border-color: #ddd #bbb #bbb #ddd; border-bottom-width: 2px; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; background-color: #f9f9f9; padding: 1px 3px; font-family: inherit; font-size: 0.85em; white-space: nowrap;">Alt</kbd>+161 yields "í" (the glyph for Latin letter i with acute accent) (CP850).

When Windows transitioned to Unicode the same thing had happened: the 0-leading codes had become so well known that a third method needed to be invented to produce Unicode code points, though it was somewhat mitigated by Unicode matching CP1252. The full-legacy Alt codes with no leading zero became more reliable as all glyphs in the legacy code pages had matching glyphs in Unicode. The following method can be used on Microsoft Windows to enter any Unicode codepoint as a hexadecimal number:

Problems

If Num Lock is disabled, attempting an Alt code may cause unexpected results in some applications. For example, Alt+4 can be taken as Alt+Left Arrow, causing a web browser to go back one page.

Many laptops do not have a separate numeric keypad; however, the Fn key can be used to turn certain keys into a numeric keypad. There usually is a key called [Num lock] to ‘shift’ certain keys to act as if they were the numeric keypad keys. For example, in laptops sold in Spain, the following scheme is very common:

7 8 9 0
U I O P
J K L Ñ
M . -

See also

Notes

  1. ^ Laptop keyboards often do not have a numpad, but may provide numpad input by holding a modifier key (typically labelled "Fn"); thus one must press and hold both Alt and Fn keys while entering the character code.

External links