首页Home › 开发工具Developer Tools

🔁 八进制转格雷码Octal to Gray Code Converter

把八进制数转换成格雷码,默认保持输入的位数(每个八进制位 3 位,保留前导 0),也可选 4/8/16/32 位,每行一个。Convert octal to Gray code, keeping the input width by default (3 bits per octal digit, leading zeros kept) or padding to 4, 8, 16 or 32 bits, one per line.

使用说明与常见问题How-to & FAQ

「八进制转格雷码」是什么?What is the Octal to Gray Code Converter tool?

把八进制数转换成格雷码,默认保持输入的位数(每个八进制位 3 位,保留前导 0),也可选 4/8/16/32 位,每行一个。Convert octal to Gray code, keeping the input width by default (3 bits per octal digit, leading zeros kept) or padding to 4, 8, 16 or 32 bits, one per line.

如何使用「八进制转格雷码」?How do I use the Octal to Gray Code Converter tool?

在「八进制转格雷码」中,把内容粘贴或输入到上方输入框,按需设置「格雷码位数」,结果会实时显示在下方,点击「复制结果」即可复制。In the Octal 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 限制。空格和下划线被当作分组符号忽略,输入可加 0o 前缀;0x、0b 不接受。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 0o; 0x and 0b are not accepted.

代码或数据会被上传吗?Is my code or data uploaded?

不会。「八进制转格雷码」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The Octal to Gray Code Converter runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.

「八进制转格雷码」免费吗?需要注册吗?Is the Octal to Gray Code Converter free? Do I need an account?

「八进制转格雷码」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Octal 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.

相关工具Related tools

🧾 JSON 格式化校验JSON Formatter & Validator🧪 正则表达式测试Regex Tester⏰ Cron 表达式解析Cron Expression Explainer🔀 YAML JSON 互转YAML to JSON Converter📊 CSV JSON 互转CSV to JSON ConverterⓂ️ Markdown 在线预览Markdown Live Preview🗄️ SQL 格式化/压缩SQL Formatter & Minifier🧵 字符串转义/反转义String Escape / Unescape📰 XML 格式化XML Formatter & Validator🔁 XML 转 JSONXML to JSON Converter🎀 CSS 格式化/压缩CSS Beautifier & Minifier🧾 HTML 格式化/压缩HTML Beautifier & Minifier

← 全部工具All tools