# Alt 代码

Alt 代码是 IBM PC 兼容计算机上的一种键盘输入序列：用户按住 Alt 键，在小键盘上输入一个十进制数字，然后松开 Alt 键，即可插入一个键盘上没有的字符。该功能源自 IBM PC 的 BIOS，并在 Windows 中保留下来——在 Windows 中，系统会根据所键入的数字确定字符集（代码页），再在其中查找对应字符。

| 关键事实 | 详情 |
|---|---|
| 基本方法 | 按住 Alt，在小键盘上输入代码，松开 Alt；主键盘上的数字行不起作用<sup>[1](https://support.microsoft.com/en-US/Windows/Hardware/Input-Devices/windows-keyboard-tips-and-tricks)</sup> |
| 起源 | IBM PC 的 BIOS，它将键入的数字视为十进制字节值，通过显卡的字符生成器呈现<sup>[2](https://devblogs.microsoft.com/oldnewthing/20240702-00/?p=109951)</sup> |
| 两种代码页 | 不带前导 0 的代码（Alt+1 至 Alt+255）映射到 IBM 代码页 437；带前导 0（如 Alt+0169 之类）则选择 Windows ANSI 代码页，在美国即代码页 1252<sup>[2](https://devblogs.microsoft.com/oldnewthing/20240702-00/?p=109951)</sup><sup> • </sup><sup>[3](https://altcodeunicode.com/)</sup> |
| 溢出行为 | 默认情况下数值按模 256 取余，因此 Alt+9731 得到 OEM 码位 3，即心形符号 ♥；RichEdit 控件则按模 65536 取余，因此 Alt+9731 得到雪人符号 ☃<sup>[2](https://devblogs.microsoft.com/oldnewthing/20240702-00/?p=109951)</sup> |
| 常用代码 | Alt+0169 ©、Alt+0174 ®、Alt+0153 ™、Alt+0150 短破折号、Alt+0151 长破折号、Alt+0176 度符号<sup>[1](https://support.microsoft.com/en-US/Windows/Hardware/Input-Devices/windows-keyboard-tips-and-tricks)</sup><sup> • </sup><sup>[4](https://support.microsoft.com/en-us/word/insert-ascii-or-unicode-latin-based-symbols-and-characters)</sup> |
| Office 中的 Unicode 输入 | 输入十六进制代码，然后按 Alt+X；PowerPoint 和 InfoPath 等部分 Office 程序无法执行此转换<sup>[4](https://support.microsoft.com/en-us/word/insert-ascii-or-unicode-latin-based-symbols-and-characters)</sup> |
| 十六进制小键盘模式 | 在 HKEY_CURRENT_USER\Control Panel\Input Method 下将注册表值 EnableHexNumpad 设为 1，即可通过按住右 Alt、按小键盘上的 +、再输入十六进制代码来输入 Unicode 字符<sup>[5](https://learn.microsoft.com/en-ca/answers/questions/5831535/alt-codes-are-not-working-at-all-windows-11)</sup> |

## 工作原理

该序列由输入系统处理，而非由应用程序的键盘布局处理。在最初的 IBM PC BIOS 中，小键盘配合 Alt 键可以输入任意 ASCII 字符：松开 Alt 后，BIOS 返回扫描码 00 以及所键入的字符码，因此按 Alt 和小键盘 1 返回十六进制 00/01，按 Alt 和小键盘 255 返回十六进制 00/FF<sup>[6](https://bitsavers.trailing-edge.com/pdf/ibm/pc/ps2/PS2_and_PC_BIOS_Interface_Technical_Reference_Apr87.pdf)</sup>。

**两种代码页。** Windows 问世时，使用代码页 1252 作为其 8 位“ANSI 字符集”，而旧的 BIOS 字符集则被追认为 OEM 字符集。为保持与 MS-DOS 的兼容性，不带前导零输入的数字仍在 OEM 字符集中查找，因此 Alt+164 产生 ñ，尽管 ñ 在代码页 1252 中的码位是 241。在小键盘上先输入一个 0 则改为请求 ANSI 代码页，这就是 Alt+0169 产生 © 的原因——该字符在 OEM 代码页中并不存在<sup>[2](https://devblogs.microsoft.com/oldnewthing/20240702-00/?p=109951)</sup>。

因此，前导零并非装饰：它决定了数字从哪张 256 字符表中读取。在美国，OEM 表是代码页 437，即最初 IBM PC 和 MS-DOS 所使用的字符集<sup>[2](https://devblogs.microsoft.com/oldnewthing/20240702-00/?p=109951)</sup><sup> • </sup><sup>[3](https://altcodeunicode.com/)</sup>。

## 模 256 问题

如果键入的数字超过 255，Windows 和 IBM PC BIOS 都会对数值按模 256 取余，因此 Alt+259 等同于 Alt+3，即 OEM 码位 3，在代码页 437 中是一个心形符号 ♥<sup>[2](https://devblogs.microsoft.com/oldnewthing/20240702-00/?p=109951)</sup>。这就是为什么网上流传的建议（以及大语言模型给出的建议）——输入 Alt+9731 得到 Unicode 雪人 ☃——在大多数程序中都会失败：9731 对 256 取模的结果等于 3，得到的又是心形符号。

结果取决于接收文本的控件。某些控件——最著名的是 [WordPad](https://www.edgepedia.org/zh/wordpad) 及其他编辑器所使用的 RichEdit 控件——会覆盖默认处理方式，按模 65536 解析数值，因此在 RichEdit 控件中 Alt+9731 确实能产生雪人符号。因此，一个较大的 Alt 代码究竟产生心形还是雪人，取决于你正在向何种控件中输入<sup>[2](https://devblogs.microsoft.com/oldnewthing/20240702-00/?p=109951)</sup>。

## 实际要求

Alt 代码需要小键盘。微软的文档指出，输入这些代码只能使用小键盘，不能使用键盘顶部的数字行；如果键盘的小键盘数字键需要 Num Lock 开启，则必须打开 Num Lock<sup>[1](https://support.microsoft.com/en-US/Windows/Hardware/Input-Devices/windows-keyboard-tips-and-tricks)</sup><sup> • </sup><sup>[4](https://support.microsoft.com/en-us/word/insert-ascii-or-unicode-latin-based-symbols-and-characters)</sup>。没有专用小键盘的笔记本电脑，或启用了“鼠标键”辅助功能的设备，是 Alt 代码失效的常见原因；外接 USB 小键盘通常能恢复标准行为<sup>[5](https://learn.microsoft.com/en-ca/answers/questions/5831535/alt-codes-are-not-working-at-all-windows-11)</sup>。

## Unicode 替代方案

由于十进制 Alt 代码每个代码页只能达到 256 个值，Windows 提供了几种输入庞大得多的 Unicode 字符集的方法：

- **Office 中的 Alt+X。** 在 Word 和 Outlook 中，输入字符的十六进制值，然后按 Alt+X 进行转换；在某些语言版本中，该组合键为 Alt+C。如果转换了前面错误的字符，请先选中目标代码，或在其前面加上“U+”，这样输入 1U+B5 再按 Alt+X 会得到 1µ<sup>[4](https://support.microsoft.com/en-us/word/insert-ascii-or-unicode-latin-based-symbols-and-characters)</sup><sup> • </sup><sup>[7](https://www.unicode.org/faq/font_keyboard.html)</sup>。
- **十六进制小键盘输入。** 在 HKEY_CURRENT_USER\Control Panel\Input Method 下创建注册表字符串 EnableHexNumpad 并设值为 1 后，按住右 Alt 键，按小键盘上的 +，输入十六进制代码（例如 ñ 为 00F1），然后松开 Alt<sup>[5](https://learn.microsoft.com/en-ca/answers/questions/5831535/alt-codes-are-not-working-at-all-windows-11)</sup>。
- **表情符号面板和字符映射表。** 按 Windows 键 + .（句点）打开表情符号面板，其“符号”选项卡提供标点、带重音字符等；字符映射表实用程序则让用户查看并复制任意已安装字体中的字符<sup>[1](https://support.microsoft.com/en-US/Windows/Hardware/Input-Devices/windows-keyboard-tips-and-tricks)</sup><sup> • </sup><sup>[4](https://support.microsoft.com/en-us/word/insert-ascii-or-unicode-latin-based-symbols-and-characters)</sup>。

其他系统使用不同的约定。在 macOS 上，添加“Unicode 十六进制输入”键盘后，用户可以按住 [Option 键](https://www.edgepedia.org/zh/option-key)并输入字符的十六进制代码，不过此输入法不支持超过四位十六进制的码位（U+10000 及以上）<sup>[7](https://www.unicode.org/faq/font_keyboard.html)</sup>。在 GNOME 及其他 GTK 桌面上，按 Ctrl+Shift+U，然后输入十六进制代码，再按空格或回车，即可插入任意 Unicode 字符<sup>[8](https://help.gnome.org/gnome-help/tips-specialchars.html.lt)</sup>。

## 常用代码

| 符号 | 名称 | Alt 代码 |
|---|---|---|
| © | 版权符号 | Alt+0169 |
| ® | 注册商标符号 | Alt+0174 |
| ™ | 商标符号 | Alt+0153 |
| • | 列表圆点 | Alt+0149 |
| § | 章节符号 | Alt+0167 |
| – | 短破折号 | Alt+0150 |
| — | 长破折号 | Alt+0151 |
| ° | 度符号 | Alt+0176 |
| ¡ | 倒感叹号 | Alt+0161 |
| ¿ | 倒问号 | Alt+0191 |
| € | 欧元符号 | Alt+0128 |
| £ | 英镑符号 | Alt+0163 |

本表中的代码是微软为 Windows 和 Word 记录的四位 ANSI 序列<sup>[1](https://support.microsoft.com/en-US/Windows/Hardware/Input-Devices/windows-keyboard-tips-and-tricks)</sup><sup> • </sup><sup>[4](https://support.microsoft.com/en-us/word/insert-ascii-or-unicode-latin-based-symbols-and-characters)</sup>。

## References

1. [Windows keyboard tips and tricks, Microsoft Support](https://support.microsoft.com/en-US/Windows/Hardware/Input-Devices/windows-keyboard-tips-and-tricks)
2. [Raymond Chen (July 2, 2024). The history of Alt+number sequences, and why Alt+9731 sometimes gives you a heart and sometimes a snowman. The Old New Thing, Microsoft DevBlogs.](https://devblogs.microsoft.com/oldnewthing/20240702-00/?p=109951)
3. [Windows Alt Codes: The Complete List, altcodeunicode.com](https://altcodeunicode.com/)
4. [Insert ASCII or Unicode Latin-based symbols and characters, Microsoft Support (Word)](https://support.microsoft.com/en-us/word/insert-ascii-or-unicode-latin-based-symbols-and-characters)
5. [Alt Codes are not working at all (Windows 11), Microsoft Q&A](https://learn.microsoft.com/en-ca/answers/questions/5831535/alt-codes-are-not-working-at-all-windows-11)
6. [PS/2 and PC BIOS Interface Technical Reference (April 1987), IBM, bitsavers](https://bitsavers.trailing-edge.com/pdf/ibm/pc/ps2/PS2_and_PC_BIOS_Interface_Technical_Reference_Apr87.pdf)
7. [FAQ: Fonts and Keyboards, Unicode Consortium](https://www.unicode.org/faq/font_keyboard.html)
8. [Enter special characters, GNOME Help](https://help.gnome.org/gnome-help/tips-specialchars.html.lt)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 计算机硬件 › Boards, peripherals & form factors › Peripherals & expansion hardware › Input devices

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/alt-code

English original: https://www.edgepedia.org/alt-code
