首页Home › 开发工具Developer Tools

⚙️ 位运算计算器Bitwise Calculator

整数位运算:AND、OR、XOR、NOT、NAND、NOR、XNOR、左移、算术右移和逻辑右移,支持 8/16/32/64 位补码或任意精度,同时显示十进制、十六进制、二进制和八进制。Bitwise operations on integers — AND, OR, XOR, NOT, NAND, NOR, XNOR, left shift, arithmetic and logical right shift — in 8/16/32/64-bit two's complement or arbitrary precision, shown in decimal, hex, binary and octal.

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

「位运算计算器」是什么?What is the Bitwise Calculator tool?

整数位运算:AND、OR、XOR、NOT、NAND、NOR、XNOR、左移、算术右移和逻辑右移,支持 8/16/32/64 位补码或任意精度,同时显示十进制、十六进制、二进制和八进制。Bitwise operations on integers — AND, OR, XOR, NOT, NAND, NOR, XNOR, left shift, arithmetic and logical right shift — in 8/16/32/64-bit two's complement or arbitrary precision, shown in decimal, hex, binary and octal.

如何使用「位运算计算器」?How do I use the Bitwise Calculator tool?

在「位运算计算器」中,填写「A」、「运算」、「B」、「位宽」等参数,结果会随输入实时计算并显示在下方。In the Bitwise Calculator: Fill in "A", "Operation", "B", "Width"; results are recalculated instantly as you type.

负数怎么表示?How are negative numbers handled?

选择 8/16/32/64 位时按二进制补码:-1 在 8 位下是 1111 1111(255),结果同时给出无符号值和有符号值;“任意精度”模式下按无限位补码计算(与 Python、JavaScript BigInt 一致),例如 ~12 = -13。With 8/16/32/64 bits, two's complement is used: -1 in 8 bits is 1111 1111 (255), and both unsigned and signed results are shown. Arbitrary precision uses infinite two's complement like Python or JavaScript BigInt, so ~12 = -13.

算术右移和逻辑右移有什么区别?Arithmetic vs logical right shift?

算术右移(>>)保留符号位,-16 >> 2 = -4;逻辑右移(>>>)在高位补 0,8 位下 -1 >>> 1 = 0111 1111 = 127。逻辑右移需要固定位宽。Arithmetic shift (>>) keeps the sign: -16 >> 2 = -4. Logical shift (>>>) fills with zeros: in 8 bits, -1 >>> 1 = 0111 1111 = 127. Logical shift needs a fixed width.

输入支持哪些格式?Which input formats work?

十进制、0x 十六进制、0b 二进制、0o 八进制,可带负号,空格和下划线会被忽略;超过位宽的输入会先截断到该位宽。Decimal, 0x hex, 0b binary and 0o octal, optionally negative; spaces and underscores are ignored. Inputs wider than the chosen width are truncated to it first.

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

不会。「位运算计算器」完全用 JavaScript 在本地运行,适合处理含有密钥、内部接口等敏感内容的数据。No. The Bitwise Calculator runs entirely in local JavaScript, so it is safe for data containing keys or internal endpoints.

「位运算计算器」免费吗?需要注册吗?Is the Bitwise Calculator free? Do I need an account?

「位运算计算器」完全免费,无需注册或安装,打开网页即可使用,手机和电脑都能用;输入的内容只在你的浏览器本地处理。The Bitwise Calculator 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

🛡️ 隐私政策生成器Privacy Policy Generator🧾 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

← 全部工具All tools