🔁 十六进制转格雷码Hexadecimal to Gray Code Converter
把十六进制数转换成格雷码,默认保持输入的位数(每个十六进制位 4 位,保留前导 0),也可选 8/16/32 位,每行一个。Convert hexadecimal to Gray code, keeping the input width by default (4 bits per hex digit, leading zeros kept) or padding to 8, 16 or 32 bits, one per line.
使用说明与常见问题How-to & FAQ
「十六进制转格雷码」是什么?What is the Hexadecimal to Gray Code Converter tool?
把十六进制数转换成格雷码,默认保持输入的位数(每个十六进制位 4 位,保留前导 0),也可选 8/16/32 位,每行一个。Convert hexadecimal to Gray code, keeping the input width by default (4 bits per hex digit, leading zeros kept) or padding to 8, 16 or 32 bits, one per line.
如何使用「十六进制转格雷码」?How do I use the Hexadecimal to Gray Code Converter tool?
在「十六进制转格雷码」中,把内容粘贴或输入到上方输入框,按需设置「格雷码位数」,结果会实时显示在下方,点击「复制结果」即可复制。In the Hexadecimal to Gray Code Converter: Paste or type into the input box, adjust "Gray code width"; the result appears below instantly — click "Copy result" to copy it.
格雷码怎么算?How is Gray code computed?
把数值 n 转成格雷码:G = n XOR (n >> 1),即最高位不变,其余每位是二进制中该位与左边一位的异或。格雷码还原:从最高位开始逐位累积异或。相邻两个数的格雷码只有一位不同。To get the Gray code of a value n: G = n XOR (n >> 1) — the top bit stays and each other bit is the XOR of that binary bit and the one to its left. To decode, XOR the bits cumulatively from the top. Neighbouring values differ in exactly one bit.
能处理多长的数?How long can the numbers be?
每行一个数,用 BigInt 精确计算,长度不受 2^53 限制。空格和下划线被当作分组符号忽略,输入可加 0x 前缀;0o、0b 不是十六进制前缀(0b1011 中的 b 会被当作十六进制数字 B,读成 0xB1011)。One number per line, computed exactly with BigInt, so there is no 2^53 limit. Spaces and underscores are ignored as grouping, and the input may start with 0x; 0o and 0b are not hexadecimal prefixes (in 0b1011 the b is read as the hex digit B, giving 0xB1011).
代码或数据会被上传吗?Is my code or data uploaded?
不会。「十六进制转格雷码」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The Hexadecimal to Gray Code Converter runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.
「十六进制转格雷码」免费吗?需要注册吗?Is the Hexadecimal to Gray Code Converter free? Do I need an account?
「十六进制转格雷码」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Hexadecimal to Gray Code Converter is completely free with no sign-up or install and works on phones and desktops; what you enter is processed only in your browser.